[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150512204556.GO23057@wotan.suse.de>
Date: Tue, 12 May 2015 22:45:56 +0200
From: "Luis R. Rodriguez" <mcgrof@...e.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "Luis R. Rodriguez" <mcgrof@...not-panic.com>,
Ming Lei <ming.lei@...onical.com>,
Rusty Russell <rusty@...tcorp.com.au>,
David Howells <dhowells@...hat.com>,
Seth Forshee <seth.forshee@...onical.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Paul Bolle <pebolle@...cali.nl>,
Linux Wireless List <linux-wireless@...r.kernel.org>,
Kyle McMartin <kyle@...nel.org>
Subject: Re: [PATCH v2 1/5] firmware: fix __getname() missing failure check
On Tue, May 12, 2015 at 01:31:58PM -0700, Linus Torvalds wrote:
> On Tue, May 12, 2015 at 11:30 AM, Luis R. Rodriguez
> <mcgrof@...not-panic.com> wrote:
> > +
> > + path = __getname();
> > + if (unlikely(!path))
> > + return PTR_ERR(path);
>
> This makes no sense.
>
> PTR_ERR() on NULL is an insane operation. It's a very non-intuitive
> and misleading way of writing "0".
>
> So not only is that "return 0;", that's not likely what you want _anyway_.
>
> If you intended to return an error, you should just have done so, eg
>
> if (unlikely(!path))
> return -ENOMEM;
>
> which actually does something sane, and is more readable.
Will fix, thanks.
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists