lkml.org 
[lkml]   [2013]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] drivers/pinctrl: grab default handles from device core
On Fri, Jan 18, 2013 at 04:08:48PM +0100, Linus Walleij wrote:
> - Abstain from using IS_ERR_OR_NULL() in the driver core,
> Russell recently sent a patch to remove it. Handle the
> NULL case explicitly even though it's a bogus case.

Hmmmmmmmm... I assume you're talking about this:

> + p = create_pinctrl(dev);
> + if (p && !IS_ERR(p))
> + kref_init(&p->users);
> + return p;

which is... interesting. In mainline currently, the version I see there
never returns NULL - it either returns an err pointer or a real pointer.

Next thing though is...

create_pinctrl adds the struct pinctrl onto the global list, and then you
intialize it here, which is an interesting sequence. It's safe at the
moment because everything here is operating under a mutex, but it's a
little obscure.

Is there a reason not to initialize p->users inside create_pinctrl() ?


\
 
 \ /
  Last update: 2013-01-18 22:02    [W:1.155 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site