Re: [PATCH v4 07/10] gpio: max7360: Add MAX7360 gpio support

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

 



On Fri, Feb 14, 2025 at 05:59:40PM +0200, Andy Shevchenko wrote:
> On Fri, Feb 14, 2025 at 12:49:57PM +0100, Mathieu Dubois-Briand wrote:

...

> > +		ret = device_property_read_u32(dev, "maxim,constant-current-disable", &outconf);
> > +		if (ret && (ret != -EINVAL))
> > +			return dev_err_probe(dev, -ENODEV,
> 
> Why shadowing the real error code?
> 
> > +					     "Failed to read maxim,constant-current-disable OF property\n");
> 
> It may be not only OF :-)

Btw, can you compare this approach and the below in terms of bloat-o-meter
against the object file size?

	// can be done without this as well, just the same string as a parameter
	const char *propname;

	propname = "maxim,constant-current-disable";
	ret = device_property_read_u32(dev, propname, &outconf);
	if (ret && (ret != -EINVAL))
		return dev_err_probe(dev, ret, "Failed to read %s device property\n", propname);

While the above is strong hint to the compiler, the below should give similar
result but by the duplicates elimination:

	ret = device_property_read_u32(dev, "maxim,constant-current-disable", &outconf);
	if (ret && (ret != -EINVAL))
		return dev_err_probe(dev, ret, "Failed to read %s device property\n",
				     "maxim,constant-current-disable");

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux