mailbox: Fix devm_ioremap_resource error detection code
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Thu, 5 May 2016 12:20:49 +0000 (17:50 +0530)
committerJassi Brar <jaswinder.singh@linaro.org>
Sun, 8 May 2016 17:14:46 +0000 (22:44 +0530)
devm_ioremap_resource returns an ERR_PTR value, not NULL,
on failure.

The Coccinelle semantic patch used to make this change is
as follows:
@@
expression e,e1;
statement S;
@@

*e = devm_ioremap_resource(...);
if (!e1) S

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/mailbox-sti.c

index 2394cfe892b684c4f7d002f9c488a02f85daa54e..a334db5c9f1c126939873555671302b97ebecae9 100644 (file)
@@ -430,8 +430,8 @@ static int sti_mbox_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        mdev->base = devm_ioremap_resource(&pdev->dev, res);
-       if (!mdev->base)
-               return -ENOMEM;
+       if (IS_ERR(mdev->base))
+               return PTR_ERR(mdev->base);
 
        ret = of_property_read_string(np, "mbox-name", &mdev->name);
        if (ret)