[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190120213853.5yh6hiw3ccfgtbmo@earth.universe>
Date: Sun, 20 Jan 2019 22:38:53 +0100
From: Sebastian Reichel <sre@...nel.org>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: twl4030: fix a missing check of return value
Hi,
On Thu, Dec 20, 2018 at 01:51:24PM -0600, Kangjie Lu wrote:
> If twl4030_bci_read() fails, the read data in "s" is incorrect,
> which is however used in the following execution. The fix checks
> the return value of twl4030_bci_read() and returns an error code
> upstream upon the failure of twl4030_bci_read().
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
Thanks, queued to power-supply-next.
-- Sebastian
> drivers/power/supply/twl4030_charger.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
> index 0e202d4273fb..4299873a1118 100644
> --- a/drivers/power/supply/twl4030_charger.c
> +++ b/drivers/power/supply/twl4030_charger.c
> @@ -809,7 +809,9 @@ static int twl4030_bci_get_property(struct power_supply *psy,
> is_charging = state & TWL4030_MSTATEC_AC;
> if (!is_charging) {
> u8 s;
> - twl4030_bci_read(TWL4030_BCIMDEN, &s);
> + ret = twl4030_bci_read(TWL4030_BCIMDEN, &s);
> + if (ret < 0)
> + return ret;
> if (psy->desc->type == POWER_SUPPLY_TYPE_USB)
> is_charging = s & 1;
> else
> --
> 2.17.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists