Re: [PATCH] iio: dln2: Check return value of devm_iio_trigger_register()

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

 



On 11/4/21 11:35 AM, Andy Shevchenko wrote:
On Mon, Nov 1, 2021 at 3:31 PM Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
Registering a trigger can fail and the return value of
devm_iio_trigger_register() must be checked. Otherwise undefined behavior
can occur when the trigger is used.
...

+       ret = devm_iio_trigger_register(dev, dln2->trig);
+       if (ret) {
+               dev_err(dev, "failed to register trigger: %d\n", ret);
+               return ret;
It's fine to use dev_err_ptobe() in ->probe() even for known error codes.
Hence,

if (ret)
  return dev_err_probe(dev, ret, "failed to register trigger\n");

+       }
Should it be a separate patch?

I'm a big fan of dev_err_probe() using it in all my new drivers for everything.

But here I'm trying to stay with the style of the existing driver. And we also want to have this as a fix that can potentially be backported.

The conversion to dev_err_probe() is best done for the whole driver in a separate feature patch.




[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