mfd: pm8xxx: Fix possible NULL dereference

CRs-fixed: 313701
Change-Id: Ie7b71d88b6f26fbff56bd9bee502931d3c1e9668
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
This commit is contained in:
Jay Chokshi
2011-10-27 15:48:33 -07:00
parent fc9f93399e
commit 14df5ceee7

View File

@@ -502,15 +502,16 @@ static void pm8xxx_batt_alarm_isr_work(struct work_struct *work)
= container_of(work, struct pm8xxx_batt_alarm_chip, irq_work);
int status;
if (chip) {
status = pm8xxx_batt_alarm_status_read();
if (!chip)
return;
if (status < 0)
pr_err("failed to read status, rc=%d\n", status);
else
srcu_notifier_call_chain(&chip->irq_notifier_list,
status, NULL);
}
status = pm8xxx_batt_alarm_status_read();
if (status < 0)
pr_err("failed to read status, rc=%d\n", status);
else
srcu_notifier_call_chain(&chip->irq_notifier_list,
status, NULL);
enable_irq(chip->irq);
}