[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1334208502.15182.0.camel@phoenix>
Date: Thu, 12 Apr 2012 13:28:22 +0800
From: Axel Lin <axel.lin@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Liam Girdwood <lrg@...com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: regulator: core: Don't dereference config->dev before NULL checking
for config
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Axel Lin <axel.lin@...il.com>
---
drivers/regulator/core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1bd71a8..bf46034 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2853,7 +2853,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
const struct regulator_init_data *init_data;
static atomic_t regulator_no = ATOMIC_INIT(0);
struct regulator_dev *rdev;
- struct device *dev = config->dev;
+ struct device *dev;
int ret, i;
const char *supply = NULL;
@@ -2883,6 +2883,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
return ERR_PTR(-EINVAL);
}
+ dev = config->dev;
init_data = config->init_data;
rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists