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 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?

-- 
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