summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-07 12:04:20 +0400
committerJiri Slaby <jslaby@suse.cz>2017-03-03 13:31:13 +0300
commit87822b39ac57dbbb3d15b713de41089b9fe01042 (patch)
treed31e2db2849517535bbf085df5d8f0d01f9407ed
parent8303768920eeff9f903e1ddd84f9c08de916b56d (diff)
downloadlinux-87822b39ac57dbbb3d15b713de41089b9fe01042.tar.xz
mfd: pm8921: Potential NULL dereference in pm8921_remove()
commit d6daef95127e41233ac8e2d8472d8c0cd8687d38 upstream. We assume that "pmic" could be NULL and then dereference it two lines later. I fix this by moving the dereference inside the NULL check. Fixes: c013f0a56c56 ('mfd: Add pm8xxx irq support') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--drivers/mfd/pm8921-core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index a6841f77aa5e..484fe66e6c88 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -171,11 +171,12 @@ static int pm8921_remove(struct platform_device *pdev)
drvdata = platform_get_drvdata(pdev);
if (drvdata)
pmic = drvdata->pm_chip_data;
- if (pmic)
+ if (pmic) {
mfd_remove_devices(pmic->dev);
- if (pmic->irq_chip) {
- pm8xxx_irq_exit(pmic->irq_chip);
- pmic->irq_chip = NULL;
+ if (pmic->irq_chip) {
+ pm8xxx_irq_exit(pmic->irq_chip);
+ pmic->irq_chip = NULL;
+ }
}
return 0;