mfd mc13xxxx: Set mc_dev to NULL on failure
The mc13xxx driver correctly bails out on failure, but leaves mc_dev initialized, so a later mc13xxx_get won't fail but returns an invalid pointer. Fix this. While at it, remove some superfluous code from mc13xxx_get. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
16678a3a43
commit
0d188aca53
|
@ -38,9 +38,6 @@ static struct mc13xxx *mc_dev;
|
|||
|
||||
struct mc13xxx *mc13xxx_get(void)
|
||||
{
|
||||
if (!mc_dev)
|
||||
return NULL;
|
||||
|
||||
return mc_dev;
|
||||
}
|
||||
EXPORT_SYMBOL(mc13xxx_get);
|
||||
|
@ -308,6 +305,7 @@ static int mc_probe(struct device_d *dev, enum mc13xxx_mode mode)
|
|||
rev = mc13xxx_query_revision(mc_dev);
|
||||
if (rev < 0) {
|
||||
free(mc_dev);
|
||||
mc_dev = NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue