spi/s3c64xx: Check before mem-region release
authorJassi Brar <jassi.brar@samsung.com>
Wed, 20 Jan 2010 20:49:44 +0000 (13:49 -0700)
committerGrant Likely <grant.likely@secretlab.ca>
Wed, 20 Jan 2010 20:49:44 +0000 (13:49 -0700)
Add precautionary check before releasing memory region.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/spi/spi_s3c64xx.c

index 3acf38119e96e7b734e023dba91d1f83e7ef9552..0e883f9c720b9d7701f54176f291cb65f004b878 100644 (file)
@@ -1097,7 +1097,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
        iounmap((void *) sdd->regs);
 
        mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       release_mem_region(mem_res->start, resource_size(mem_res));
+       if (mem_res != NULL)
+               release_mem_region(mem_res->start, resource_size(mem_res));
 
        platform_set_drvdata(pdev, NULL);
        spi_master_put(master);