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: <131231eb77014ce38bbe611e99be5ebb713c471d.camel@gmail.com>
Date: Wed, 05 Jun 2024 10:40:24 +0200
From: Nuno Sá <noname.nuno@...il.com>
To: Alisa-Dariana Roman <alisadariana@...il.com>, Alisa-Dariana Roman
 <alisa.roman@...log.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>, 
 Michael Hennerich <michael.hennerich@...log.com>,
 linux-iio@...r.kernel.org, devicetree@...r.kernel.org, 
 linux-kernel@...r.kernel.org
Cc: Lars-Peter Clausen <lars@...afoo.de>, Alexandru Tachici
 <alexandru.tachici@...log.com>, Jonathan Cameron <jic23@...nel.org>, Rob
 Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor
 Dooley <conor+dt@...nel.org>, Liam Girdwood <lgirdwood@...il.com>, Mark
 Brown <broonie@...nel.org>
Subject: Re: [PATCH v2 1/3] iio: adc: ad7192: Clean up dev

On Wed, 2024-06-05 at 10:51 +0300, Alisa-Dariana Roman wrote:
> Clean up by using a local variable struct device *dev.
> 
> Signed-off-by: Alisa-Dariana Roman <alisa.roman@...log.com>
> ---
>  drivers/iio/adc/ad7192.c | 45 ++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 0789121236d6..f06cb7ac4b42 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -1196,17 +1196,18 @@ static void ad7192_reg_disable(void *reg)
>  
>  static int ad7192_probe(struct spi_device *spi)
>  {
> +	struct device *dev = &spi->dev;
>  	struct ad7192_state *st;
>  	struct iio_dev *indio_dev;
>  	struct regulator *aincom;
>  	int ret;
>  
>  	if (!spi->irq) {
> -		dev_err(&spi->dev, "no IRQ?\n");
> +		dev_err(dev, "no IRQ?\n");

Since you're here, dev_err_probe()?

>  		return -ENODEV;
>  	}
>  
> -	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
>  	if (!indio_dev)
>  		return -ENOMEM;
>  
> @@ -1219,71 +1220,71 @@ static int ad7192_probe(struct spi_device *spi)
>  	 * Newer firmware should provide a zero volt fixed supply if wired to
>  	 * ground.
>  	 */
> -	aincom = devm_regulator_get_optional(&spi->dev, "aincom");
> +	aincom = devm_regulator_get_optional(dev, "aincom");
>  	if (IS_ERR(aincom)) {
>  		if (PTR_ERR(aincom) != -ENODEV)
> -			return dev_err_probe(&spi->dev, PTR_ERR(aincom),
> +			return dev_err_probe(dev, PTR_ERR(aincom),
>  					     "Failed to get AINCOM
> supply\n");
>  
>  		st->aincom_mv = 0;
>  	} else {
>  		ret = regulator_enable(aincom);
>  		if (ret)
> -			return dev_err_probe(&spi->dev, ret,
> +			return dev_err_probe(dev, ret,
>  					     "Failed to enable specified
> AINCOM supply\n");
>  
> -		ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable,
> aincom);
> +		ret = devm_add_action_or_reset(dev, ad7192_reg_disable,
> aincom);
>  		if (ret)
>  			return ret;
>  
>  		ret = regulator_get_voltage(aincom);
>  		if (ret < 0)
> -			return dev_err_probe(&spi->dev, ret,
> +			return dev_err_probe(dev, ret,
>  					     "Device tree error, AINCOM
> voltage undefined\n");
>  		st->aincom_mv = ret / MILLI;
>  	}
>  
> -	st->avdd = devm_regulator_get(&spi->dev, "avdd");
> +	st->avdd = devm_regulator_get(dev, "avdd");
>  	if (IS_ERR(st->avdd))
>  		return PTR_ERR(st->avdd);
>  
>  	ret = regulator_enable(st->avdd);
>  	if (ret) {
> -		dev_err(&spi->dev, "Failed to enable specified AVdd
> supply\n");
> +		dev_err(dev, "Failed to enable specified AVdd supply\n");

ditto

>  		return ret;
>  	}
>  
> -	ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st-
> >avdd);
> +	ret = devm_add_action_or_reset(dev, ad7192_reg_disable, st->avdd);
>  	if (ret)
>  		return ret;
>  
> -	ret = devm_regulator_get_enable(&spi->dev, "dvdd");
> +	ret = devm_regulator_get_enable(dev, "dvdd");
>  	if (ret)
> -		return dev_err_probe(&spi->dev, ret, "Failed to enable
> specified DVdd supply\n");
> +		return dev_err_probe(dev, ret, "Failed to enable specified
> DVdd supply\n");
>  
> -	st->vref = devm_regulator_get_optional(&spi->dev, "vref");
> +	st->vref = devm_regulator_get_optional(dev, "vref");
>  	if (IS_ERR(st->vref)) {
>  		if (PTR_ERR(st->vref) != -ENODEV)
>  			return PTR_ERR(st->vref);
>  
>  		ret = regulator_get_voltage(st->avdd);
>  		if (ret < 0)
> -			return dev_err_probe(&spi->dev, ret,
> +			return dev_err_probe(dev, ret,
>  					     "Device tree error, AVdd voltage
> undefined\n");
>  	} else {
>  		ret = regulator_enable(st->vref);
>  		if (ret) {
> -			dev_err(&spi->dev, "Failed to enable specified Vref
> supply\n");
> +			dev_err(dev, "Failed to enable specified Vref
> supply\n");

ditto

>  			return ret;
>  		}
>  
> -		ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable,
> st->vref);
> +		ret = devm_add_action_or_reset(dev, ad7192_reg_disable, st-
> >vref);
>  		if (ret)
>  			return ret;
>  
>  		ret = regulator_get_voltage(st->vref);
>  		if (ret < 0)
> -			return dev_err_probe(&spi->dev, ret,
> +			return dev_err_probe(dev, ret,
>  					     "Device tree error, Vref voltage
> undefined\n");
>  	}
>  	st->int_vref_mv = ret / 1000;
> @@ -1305,13 +1306,13 @@ static int ad7192_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> -	ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev);
> +	ret = devm_ad_sd_setup_buffer_and_trigger(dev, indio_dev);
>  	if (ret)
>  		return ret;
>  
>  	st->fclk = AD7192_INT_FREQ_MHZ;
>  
> -	st->mclk = devm_clk_get_optional_enabled(&spi->dev, "mclk");
> +	st->mclk = devm_clk_get_optional_enabled(dev, "mclk");
>  	if (IS_ERR(st->mclk))
>  		return PTR_ERR(st->mclk);
>  
> @@ -1321,17 +1322,17 @@ static int ad7192_probe(struct spi_device *spi)
>  	    st->clock_sel == AD7192_CLK_EXT_MCLK2) {
>  		st->fclk = clk_get_rate(st->mclk);
>  		if (!ad7192_valid_external_frequency(st->fclk)) {
> -			dev_err(&spi->dev,
> +			dev_err(dev,
>  				"External clock frequency out of bounds\n");

ditto 

- Nuno Sá

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ