Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933649AbbELUqB (ORCPT ); Tue, 12 May 2015 16:46:01 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39291 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932574AbbELUp7 (ORCPT ); Tue, 12 May 2015 16:45:59 -0400 Date: Tue, 12 May 2015 22:45:56 +0200 From: "Luis R. Rodriguez" To: Linus Torvalds Cc: "Luis R. Rodriguez" , Ming Lei , Rusty Russell , David Howells , Seth Forshee , Linux Kernel Mailing List , Paul Bolle , Linux Wireless List , Kyle McMartin Subject: Re: [PATCH v2 1/5] firmware: fix __getname() missing failure check Message-ID: <20150512204556.GO23057@wotan.suse.de> References: <1431455457-25322-1-git-send-email-mcgrof@do-not-panic.com> <1431455457-25322-2-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 30 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 > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/