On 25 June 2013 10:32, Jonghwa Lee <[email protected]> wrote: > This patch fixes return value checking of regulator_get() in charger-manager > driver. The API, regulator_get(), returns ERR_PTR() when it fails to get > regulator with given name, not NULL. > > Signed-off-by: Jonghwa Lee <[email protected]> > Signed-off-by: Myungjoo Ham <[email protected]> > --- > drivers/power/charger-manager.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c > index ba42029..7d1bcde 100644 > --- a/drivers/power/charger-manager.c > +++ b/drivers/power/charger-manager.c > @@ -1239,7 +1239,7 @@ static int charger_manager_register_extcon(struct > charger_manager *cm) > > charger->consumer = regulator_get(cm->dev, > charger->regulator_name); > - if (charger->consumer == NULL) { > + if (IS_ERR(charger->consumer)) { > dev_err(cm->dev, "Cannot find charger(%s)\n", > charger->regulator_name); > ret = -EINVAL;
You can as well make this ret = PTR_ERR(charger->consumer). --- With warm regards, Sachin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

