Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1448954 > unrolled thread

is_err checking

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-07-23 17:00 +0200
Last post2016-07-24 17:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  is_err checking Julia Lawall <julia.lawall@lip6.fr> - 2016-07-23 17:00 +0200
    Re: is_err checking walter harms <wharms@bfs.de> - 2016-07-24 15:20 +0200
      Re: is_err checking Julia Lawall <julia.lawall@lip6.fr> - 2016-07-24 17:40 +0200

#1448954 — is_err checking

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-07-23 17:00 +0200
Subjectis_err checking
Message-ID<rY6zf-3ZH-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1449136

Fromwalter harms <wharms@bfs.de>
Date2016-07-24 15:20 +0200
Message-ID<rYru1-8mY-11@gated-at.bofh.it>
In reply to#1448954

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
> 

[toc] | [prev] | [next] | [standalone]


#1449157

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-07-24 17:40 +0200
Message-ID<rYtFw-19R-5@gated-at.bofh.it>
In reply to#1449136

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web