Re: [PATCH] power: supply: remove dead code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> ---

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
> 

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux