Re: [PATCH v3 4/6] iio: light: stk3310: use dev_err_probe where possible

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

 



On Mon, Oct 28, 2024 at 10:19:58AM -0400, Aren Moynihan wrote:
> Using dev_err_probe instead of dev_err and return makes the errors
> easier to understand by including the error name, and saves a little
> code.

...

>  		data->reg_##name =					    \
>  			devm_regmap_field_alloc(&client->dev, regmap,	    \
>  				stk3310_reg_field_##name);		    \
> -		if (IS_ERR(data->reg_##name)) {				    \
> -			dev_err(&client->dev, "reg field alloc failed.\n"); \
> -			return PTR_ERR(data->reg_##name);		    \
> -		}							    \
> +		if (IS_ERR(data->reg_##name))				    \
> +			return dev_err_probe(&client->dev,		    \
> +				PTR_ERR(data->reg_##name),		    \
> +				"reg field alloc failed.\n");		    \
>  	} while (0)

Same remark, if client is not used here, supply struct device pointer directly
and make these all lines better to read.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux