[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b547c228-df70-4137-9e96-175923f62404@ijzerbout.nl>
Date: Fri, 6 Dec 2024 20:51:00 +0100
From: Kees Bakker <kees@...erbout.nl>
To: Csókás, Bence <csokas.bence@...lan.hu>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Samuel Holland <samuel@...lland.org>, Sebastian Reichel <sre@...nel.org>
Subject: Re: [PATCH v5 3/8] power: ip5xxx_power: Allow for more parameters to
be configured
Op 19-11-2024 om 19:07 schreef Csókás, Bence:
> Other parts such as IP5306 may support other battery voltages and
> have different constants for input voltage regulation. Allow these
> to be passed from `struct ip5xxx_regfield_config`.
>
> Signed-off-by: Csókás, Bence <csokas.bence@...lan.hu>
> ---
> drivers/power/supply/ip5xxx_power.c | 43 ++++++++++++++++++++++++++---
> 1 file changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c
> index 41d91504eb32..a939dbfe8d23 100644
> --- a/drivers/power/supply/ip5xxx_power.c
> +++ b/drivers/power/supply/ip5xxx_power.c
> [...]
> /*
> @@ -328,6 +348,9 @@ static int ip5xxx_battery_get_voltage_max(struct ip5xxx *ip5xxx, int *val)
> if (ret)
> return ret;
>
> + if (*val > ip5xxx->vbat_max)
> + return -EINVAL;
This is introducing the read of an uninitialized variable.
You have to check all the callers of ip5xxx_battery_get_voltage_max()
and what variable *val is pointing to. For example in
ip5xxx_battery_get_property() the variable vmax is not initialized,
while its address is passed to ip5xxx_battery_get_voltage_max()
But maybe the intention was to check rval instead of *val?
[...]
Powered by blists - more mailing lists