[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221029000448.zanbx2cdb6woxw36@mercury.elektranox.org>
Date: Sat, 29 Oct 2022 02:04:48 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Muhammad Usama Anjum <usama.anjum@...labora.com>
Cc: kernel@...labora.com, kernel-janitors@...r.kernel.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: supply: remove dead code
Hi,
On Tue, Oct 04, 2022 at 12:36:51PM +0500, Muhammad Usama Anjum wrote:
> tmp is an unsigned variable. It can never be less than zero. Remove the
> dead code.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
> ---
Right, but the return value of regmap_bulk_read() should be checked
instead.
-- Sebastian
> drivers/power/supply/rk817_charger.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
> index aa4b33f1bb83..ba3f5ccaeacd 100644
> --- a/drivers/power/supply/rk817_charger.c
> +++ b/drivers/power/supply/rk817_charger.c
> @@ -785,8 +785,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger,
> regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3,
> bulk_reg, 4);
> tmp = get_unaligned_be32(bulk_reg);
> - if (tmp < 0)
> - tmp = 0;
> boot_charge_mah = ADC_TO_CHARGE_UAH(tmp,
> charger->res_div) / 1000;
> /*
> @@ -825,8 +823,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger,
> regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3,
> bulk_reg, 4);
> tmp = get_unaligned_be32(bulk_reg);
> - if (tmp < 0)
> - tmp = 0;
> boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, charger->res_div) / 1000;
> regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_OCV_VOL_H,
> bulk_reg, 2);
> --
> 2.30.2
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists