Re: [PATCH 2/4] iio: temperature: ltc2983: convert to dev_err_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 04, 2024 at 01:06:24PM +0200, Nuno Sa wrote:
> Use dev_err_probe() in the probe() path. While at it, made some simple
> improvements:
>  * Declare a struct device *dev helper. This also makes the style more
>    consistent (some places the helper was used and not in other places);
>  * Explicitly included the err.h and errno.h headers;
>  * Removed an useless else if();
>  * Removed some unnecessary line breaks.

...

>  	if (!(thermo->sensor_config & LTC2983_THERMOCOUPLE_DIFF_MASK) &&
> -	    sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) {

It's better if you leave {} when the body goes after a single line.
This applies to your entire series.

> -		dev_err(&st->spi->dev,
> -			"Invalid chann:%d for differential thermocouple",
> -			sensor->chan);
> -		return ERR_PTR(-EINVAL);
> -	}
> +	    sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN)
> +		return dev_errp_probe(dev, -EINVAL,
> +				      "Invalid chann:%d for differential thermocouple",
> +				      sensor->chan);

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux