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  linux-cve-announce  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]
Message-ID: <7b91ef22-2996-4e2e-b791-0cfcd4ce1fdd@kontron.de>
Date: Tue, 17 Dec 2024 10:04:15 +0100
From: Frieder Schrempf <frieder.schrempf@...tron.de>
To: Ahmad Fatoum <a.fatoum@...gutronix.de>,
 Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
 Robin Gong <yibin.gong@....com>
Cc: linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH] regulator: pca9450: use dev_err_probe on errors
 requesting resources

On 17.12.24 9:59 AM, Ahmad Fatoum wrote:
> Probe functions requesting resources may return -EPROBE_DEFER to
> the driver core to instruct it to retry probe at a later time.
> This is not unusual and printing an error message unconditionally
> is just confusing to users:
> 
>   nxp-pca9450 0-0025: Failed to register regulator(buck1): -517
> 
> Using dev_err_probe remedies this:
> 
> The error message will only be shown if the error code is not
> -EPROBE_DEFER and if it is, the deferral reason is saved for display
> at a later time.
> 
> Fixes: 0935ff5f1f0a ("regulator: pca9450: add pca9450 pmic driver")
> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>

There is a similar change already queued in next:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/regulator/pca9450-regulator.c?id=0f5c601098bd3c9cdfea3e01aacdd9d0c4010ea7

> ---
>  drivers/regulator/pca9450-regulator.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
> index 9714afe347dcc0205b40243252638dff5f9298ad..8f5ba59f7fe52bee1e467a3e6adf81a6a5476221 100644
> --- a/drivers/regulator/pca9450-regulator.c
> +++ b/drivers/regulator/pca9450-regulator.c
> @@ -953,13 +953,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>  		config.dev = pca9450->dev;
>  
>  		rdev = devm_regulator_register(pca9450->dev, desc, &config);
> -		if (IS_ERR(rdev)) {
> -			ret = PTR_ERR(rdev);
> -			dev_err(pca9450->dev,
> -				"Failed to register regulator(%s): %d\n",
> -				desc->name, ret);
> -			return ret;
> -		}
> +		if (IS_ERR(rdev))
> +			return dev_err_probe(pca9450->dev, PTR_ERR(rdev),
> +				"Failed to register regulator(%s)\n",
> +				desc->name);
>  	}
>  
>  	if (pca9450->irq) {
> @@ -968,9 +965,9 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>  						(IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
>  						"pca9450-irq", pca9450);
>  		if (ret != 0) {
> -			dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
> -				pca9450->irq);
> -			return ret;
> +			return dev_err_probe(pca9450->dev, ret,
> +					     "Failed to request IRQ: %d\n",
> +					     pca9450->irq);
>  		}
>  		/* Unmask all interrupt except PWRON/WDOG/RSVD */
>  		ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
> @@ -1022,10 +1019,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>  	 */
>  	pca9450->sd_vsel_gpio = gpiod_get_optional(pca9450->dev, "sd-vsel", GPIOD_OUT_HIGH);
>  
> -	if (IS_ERR(pca9450->sd_vsel_gpio)) {
> -		dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n");
> -		return PTR_ERR(pca9450->sd_vsel_gpio);
> -	}
> +	if (IS_ERR(pca9450->sd_vsel_gpio))
> +		return dev_err_probe(&i2c->dev,
> +				     PTR_ERR(pca9450->sd_vsel_gpio),
> +				     "Failed to get SD_VSEL GPIO\n");
>  
>  	dev_info(&i2c->dev, "%s probed.\n",
>  		type == PCA9450_TYPE_PCA9450A ? "pca9450a" :
> 
> ---
> base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
> change-id: 20241217-pca9450-dev_err_probe-778149cae5ee
> 
> Best regards,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ