Commit 7cf5244c authored by Roel Kluin's avatar Roel Kluin Committed by Samuel Ortiz

mfd: check for platform_get_irq() return value in sm501

sm501_devdata->irq is unsigned, while platform_get_irq() returns a
signed int.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@openedhand.com>
parent 7ab18995
...@@ -1374,31 +1374,31 @@ static int sm501_init_dev(struct sm501_devdata *sm) ...@@ -1374,31 +1374,31 @@ static int sm501_init_dev(struct sm501_devdata *sm)
static int sm501_plat_probe(struct platform_device *dev) static int sm501_plat_probe(struct platform_device *dev)
{ {
struct sm501_devdata *sm; struct sm501_devdata *sm;
int err; int ret;
sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
if (sm == NULL) { if (sm == NULL) {
dev_err(&dev->dev, "no memory for device data\n"); dev_err(&dev->dev, "no memory for device data\n");
err = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
sm->dev = &dev->dev; sm->dev = &dev->dev;
sm->pdev_id = dev->id; sm->pdev_id = dev->id;
sm->irq = platform_get_irq(dev, 0);
sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
sm->platdata = dev->dev.platform_data; sm->platdata = dev->dev.platform_data;
if (sm->irq < 0) { ret = platform_get_irq(dev, 0);
if (ret < 0) {
dev_err(&dev->dev, "failed to get irq resource\n"); dev_err(&dev->dev, "failed to get irq resource\n");
err = sm->irq;
goto err_res; goto err_res;
} }
sm->irq = ret;
sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (sm->io_res == NULL || sm->mem_res == NULL) { if (sm->io_res == NULL || sm->mem_res == NULL) {
dev_err(&dev->dev, "failed to get IO resource\n"); dev_err(&dev->dev, "failed to get IO resource\n");
err = -ENOENT; ret = -ENOENT;
goto err_res; goto err_res;
} }
...@@ -1407,7 +1407,7 @@ static int sm501_plat_probe(struct platform_device *dev) ...@@ -1407,7 +1407,7 @@ static int sm501_plat_probe(struct platform_device *dev)
if (sm->regs_claim == NULL) { if (sm->regs_claim == NULL) {
dev_err(&dev->dev, "cannot claim registers\n"); dev_err(&dev->dev, "cannot claim registers\n");
err= -EBUSY; ret = -EBUSY;
goto err_res; goto err_res;
} }
...@@ -1418,7 +1418,7 @@ static int sm501_plat_probe(struct platform_device *dev) ...@@ -1418,7 +1418,7 @@ static int sm501_plat_probe(struct platform_device *dev)
if (sm->regs == NULL) { if (sm->regs == NULL) {
dev_err(&dev->dev, "cannot remap registers\n"); dev_err(&dev->dev, "cannot remap registers\n");
err = -EIO; ret = -EIO;
goto err_claim; goto err_claim;
} }
...@@ -1430,7 +1430,7 @@ static int sm501_plat_probe(struct platform_device *dev) ...@@ -1430,7 +1430,7 @@ static int sm501_plat_probe(struct platform_device *dev)
err_res: err_res:
kfree(sm); kfree(sm);
err1: err1:
return err; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment