lkml.org 
[lkml]   [2019]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] nvmem: core: fix the return value check when calling the notifier chain
pt., 15 lut 2019 o 10:28 Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> napisał(a):
>
>
>
> On 14/02/2019 16:23, Bartosz Golaszewski wrote:
> > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> > index f7301bb4ef3b..a3bed2d9aec7 100644
> > --- a/drivers/nvmem/core.c
> > +++ b/drivers/nvmem/core.c
> > @@ -687,7 +687,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> > goto err_remove_cells;
> >
> > rval = blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
> > - if (rval)
> > + if (rval < 0)
> > goto err_remove_cells;
>
> rval will be masked with STOP MASK, so the above statement could be
> false even if we have error.
> So you should consider returning an errono which can be understood by user:
>
> may be something like this:
>
> if (rval & NOTIFY_STOP_MASK) {
> rval = notifier_to_errno(rval);
> goto err_remove_cells
> }
>

Actually I'm now thinking we can remove this check at all - most users
never check the return values of notifier chain calls. This function
cannot fail in itself. What do you think?

Bart

\
 
 \ /
  Last update: 2019-02-15 10:42    [W:0.052 / U:36.420 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site