* [PATCH] power: supply: remove dead code
@ 2022-10-04 7:36 Muhammad Usama Anjum
2022-10-29 0:04 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Usama Anjum @ 2022-10-04 7:36 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-pm, linux-kernel
tmp is an unsigned variable. It can never be less than zero. Remove the
dead code.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: supply: remove dead code
2022-10-04 7:36 [PATCH] power: supply: remove dead code Muhammad Usama Anjum
@ 2022-10-29 0:04 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2022-10-29 0:04 UTC (permalink / raw)
To: Muhammad Usama Anjum; +Cc: kernel, kernel-janitors, linux-pm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]
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@collabora.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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-29 0:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 7:36 [PATCH] power: supply: remove dead code Muhammad Usama Anjum
2022-10-29 0:04 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).