Messages in this thread | | | Subject | Re: [PATCH] extcon: fix a missing check of regmap_read | From | Hans de Goede <> | Date | Mon, 18 Mar 2019 18:30:27 +0100 |
| |
Hi,
On 18-03-19 17:41, Kangjie Lu wrote: > When regmap_read fails, it doesn't make sense to use the read > value "val" because it can be uninitialized. > > The fix returns if regmap_read fails. > > Signed-off-by: Kangjie Lu <kjlu@umn.edu> > --- > drivers/extcon/extcon-axp288.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c > index a983708b77a6..b2ba5f073aa7 100644 > --- a/drivers/extcon/extcon-axp288.c > +++ b/drivers/extcon/extcon-axp288.c > @@ -143,6 +143,10 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info) > int ret; > > ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val); > + if (ret) { > + dev_dbg(info->dev, "regmap_read error %d\n", ret); > + return; > + } > for (i = 0, rsi = axp288_pwr_up_down_info; *rsi; rsi++, i++) { > if (val & BIT(i)) { > dev_dbg(info->dev, "%s\n", *rsi);
Patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
| |