public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* is_err checking
@ 2016-07-23 14:56 Julia Lawall
  2016-07-24 13:17 ` walter harms
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-07-23 14:56 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-kernel

Code like the following looks a bit clunky to me:

if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER)

Is there any reason not to always use eg

data->clk == ERR_PTR(-EPROBE_DEFER)

Code of the latter form is a bit more popular.  Perhaps one could want
something like:

IS_ERR_VALUE(data->clk, -EPROBE_DEFER)

but IS_ERR_VALUE is laready used for something else.

julia

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is_err checking
  2016-07-23 14:56 is_err checking Julia Lawall
@ 2016-07-24 13:17 ` walter harms
  2016-07-24 15:37   ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2016-07-24 13:17 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-kernel



Am 23.07.2016 16:56, schrieb Julia Lawall:
> Code like the following looks a bit clunky to me:
> 
> if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER)
> 
> Is there any reason not to always use eg
> 
> data->clk == ERR_PTR(-EPROBE_DEFER)
> 
> Code of the latter form is a bit more popular.  Perhaps one could want
> something like:
> 
> IS_ERR_VALUE(data->clk, -EPROBE_DEFER)
> 
> but IS_ERR_VALUE is laready used for something else.
> 

note: i do not like hiding behind #defines

did you actually see code like IS_ERR_VALUE(data->clk, -EPROBE_DEFER)
in the current kernel ?
because there is no second argument:

#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)

or is this a misunderstanding ?

re,
 wh

> julia
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is_err checking
  2016-07-24 13:17 ` walter harms
@ 2016-07-24 15:37   ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2016-07-24 15:37 UTC (permalink / raw)
  To: walter harms; +Cc: kernel-janitors, linux-kernel



On Sun, 24 Jul 2016, walter harms wrote:

>
>
> Am 23.07.2016 16:56, schrieb Julia Lawall:
> > Code like the following looks a bit clunky to me:
> >
> > if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER)
> >
> > Is there any reason not to always use eg
> >
> > data->clk == ERR_PTR(-EPROBE_DEFER)
> >
> > Code of the latter form is a bit more popular.  Perhaps one could want
> > something like:
> >
> > IS_ERR_VALUE(data->clk, -EPROBE_DEFER)
> >
> > but IS_ERR_VALUE is laready used for something else.
> >
>
> note: i do not like hiding behind #defines
>
> did you actually see code like IS_ERR_VALUE(data->clk, -EPROBE_DEFER)
> in the current kernel ?

No, no.  It's the combination of English words I thought would be useful
for expressing the concept.  But it's already used for something else.

julia

> because there is no second argument:
>
> #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
>
> or is this a misunderstanding ?
>
> re,
>  wh
>
> > julia
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-24 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-23 14:56 is_err checking Julia Lawall
2016-07-24 13:17 ` walter harms
2016-07-24 15:37   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox