lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 3 May 2020 21:55:26 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:     Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH v2 02/11] power: bq25890: simplify chip name property
 getter

Hi,

On Sun, May 03, 2020 at 05:21:10PM +0200, Michał Mirosław wrote:
> Driver rejects unknown chips early in the probe(), so when
> bq25890_power_supply_get_property() is made reachable, bq->chip_version
> will already be set to correct value - there is no need to check
> it again.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/bq25890_charger.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index c642519ef7b2..f9f29edadddc 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -32,6 +32,13 @@ enum bq25890_chip_version {
>  	BQ25896,
>  };
>  
> +static const char *const bq25890_chip_name[] = {
> +	"BQ25890",
> +	"BQ25892",
> +	"BQ25895",
> +	"BQ25896",
> +};
> +
>  enum bq25890_fields {
>  	F_EN_HIZ, F_EN_ILIM, F_IILIM,				     /* Reg00 */
>  	F_BHOT, F_BCOLD, F_VINDPM_OFS,				     /* Reg01 */
> @@ -400,17 +407,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
>  		break;
>  
>  	case POWER_SUPPLY_PROP_MODEL_NAME:
> -		if (bq->chip_version == BQ25890)
> -			val->strval = "BQ25890";
> -		else if (bq->chip_version == BQ25892)
> -			val->strval = "BQ25892";
> -		else if (bq->chip_version == BQ25895)
> -			val->strval = "BQ25895";
> -		else if (bq->chip_version == BQ25896)
> -			val->strval = "BQ25896";
> -		else
> -			val->strval = "UNKNOWN";
> -
> +		val->strval = bq25890_chip_name[bq->chip_version];
>  		break;
>  
>  	case POWER_SUPPLY_PROP_ONLINE:
> -- 
> 2.20.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists