lkml.org 
[lkml]   [2015]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/15] trivial: Drop unlikely before IS_ERR(_OR_NULL)
On Fri, Jul 31, 2015 at 11:41:09AM +0200, Vlastimil Babka wrote:
> On 07/31/2015 10:38 AM, Viresh Kumar wrote:
> >Hi,
> >
> >This cleans up the usage of IS_ERR(_OR_NULL)(), where the callers have
> >added additional unlikely compiler flag to them. It also fixes the
> >definition of IS_ERR_OR_NULL(), to use unlikely for all checks it does.
>
> [+CC Steven Rostedt]
>
> Any idea what the compiler does in the case of
> "if (likely(IS_ERR(...)))"? There are apparently such cases in the source.

We have two cases in code:

drivers/rtc/rtc-gemini.c: if (likely(IS_ERR(rtc->rtc_dev)))
drivers/staging/lustre/lustre/obdclass/lu_object.c: if (likely(IS_ERR(shadow) && PTR_ERR(shadow) == -ENOENT)) {

The first one is mistake, I think. Or do we expect rtc_device_register()
to fail?

The second is redundant. "if (PTR_ERR(shadow) == -ENOENT)" should do the
job.

--
Kirill A. Shutemov


\
 
 \ /
  Last update: 2015-07-31 12:41    [W:0.380 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site