aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-07 03:04:20 -0500
committerLee Jones <lee.jones@linaro.org>2013-11-11 06:22:19 -0500
commitd6daef95127e41233ac8e2d8472d8c0cd8687d38 (patch)
tree6c7794b5eaced7e3d7d3d1f092d5574917ace27f /drivers/mfd
parent0b208e41acf34c133a55a57189af30aa7924e0c6 (diff)
mfd: pm8921: Potential NULL dereference in pm8921_remove()
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>
Diffstat (limited to 'drivers/mfd')
-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)
171 drvdata = platform_get_drvdata(pdev); 171 drvdata = platform_get_drvdata(pdev);
172 if (drvdata) 172 if (drvdata)
173 pmic = drvdata->pm_chip_data; 173 pmic = drvdata->pm_chip_data;
174 if (pmic) 174 if (pmic) {
175 mfd_remove_devices(pmic->dev); 175 mfd_remove_devices(pmic->dev);
176 if (pmic->irq_chip) { 176 if (pmic->irq_chip) {
177 pm8xxx_irq_exit(pmic->irq_chip); 177 pm8xxx_irq_exit(pmic->irq_chip);
178 pmic->irq_chip = NULL; 178 pmic->irq_chip = NULL;
179 }
179 } 180 }
180 181
181 return 0; 182 return 0;