Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933056AbbHINaA (ORCPT ); Sun, 9 Aug 2015 09:30:00 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54302 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932996AbbHIN35 (ORCPT ); Sun, 9 Aug 2015 09:29:57 -0400 MIME-Version: 1.0 In-Reply-To: <1438725604-22795-4-git-send-email-mcgrof@do-not-panic.com> References: <1438725604-22795-1-git-send-email-mcgrof@do-not-panic.com> <1438725604-22795-4-git-send-email-mcgrof@do-not-panic.com> Date: Sun, 9 Aug 2015 09:29:55 -0400 Message-ID: Subject: Re: [PATCH 3/4] firmware: fold successful fw read early From: Ming Lei To: "Luis R. Rodriguez" Cc: Greg Kroah-Hartman , Jonathan Corbet , Linux Kernel Mailing List , "linux-doc@vger.kernel.org" , David Woodhouse , David Howells , seth.forshee@canonical.com, Rusty Russell , Michal Marek , Matthew Garrett , kyle@kernel.org, linux-security-module , keyrings@linux-nfs.org, "Luis R. Rodriguez" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2040 Lines: 56 On Tue, Aug 4, 2015 at 6:00 PM, Luis R. Rodriguez wrote: > From: David Howells > > We'll be folding in some more checks on fw_read_file_contents(), > this will make the success case easier to follow. > > Signed-off-by: David Howells > Signed-off-by: Luis R. Rodriguez > --- > drivers/base/firmware_class.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > index 9ee334c1b872..736fb952b75b 100644 > --- a/drivers/base/firmware_class.c > +++ b/drivers/base/firmware_class.c > @@ -361,20 +361,18 @@ static int fw_get_filesystem_firmware(struct device *device, > continue; > rc = fw_read_file_contents(file, buf); > fput(file); > - if (rc) > + if (rc == 0) { > + dev_dbg(device, "system data: direct-loading firmware %s\n", > + buf->fw_id); > + fw_finish_direct_load(device, buf); > + goto out; 'break' should be enough, and the following 'out' label can be saved too. > + } else > dev_warn(device, "system data, attempted to load %s, but failed with error %d\n", > path, rc); > - else > - break; > } > +out: > __putname(path); > > - if (!rc) { > - dev_dbg(device, "system data: direct-loading firmware %s\n", > - buf->fw_id); > - fw_finish_direct_load(device, buf); > - } > - > return rc; > } > > -- > 2.3.2.209.gd67f9d5.dirty > -- 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/