aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMattias Wallin <mattias.wallin@stericsson.com>2010-12-02 09:08:32 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2011-01-14 06:37:46 -0500
commit6bce7bf1a1f8a79a57ff69910c115e1d2ed8913d (patch)
tree2ce014804679792a95e4ee7739951d09af8d989c /drivers/mfd
parentec9d0cf578007fa3f86fa34d77d9ccba82f03b29 (diff)
mfd: ab8500-core improved error handling in get_chip_id
We check for dev before dereferencing it. Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ab8500-core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index d9640a623ff4..e91b5b759004 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -103,8 +103,12 @@ static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = {
103 103
104static int ab8500_get_chip_id(struct device *dev) 104static int ab8500_get_chip_id(struct device *dev)
105{ 105{
106 struct ab8500 *ab8500 = dev_get_drvdata(dev->parent); 106 struct ab8500 *ab8500;
107 return (int)ab8500->chip_id; 107
108 if (!dev)
109 return -EINVAL;
110 ab8500 = dev_get_drvdata(dev->parent);
111 return ab8500 ? (int)ab8500->chip_id : -EINVAL;
108} 112}
109 113
110static int set_register_interruptible(struct ab8500 *ab8500, u8 bank, 114static int set_register_interruptible(struct ab8500 *ab8500, u8 bank,