From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754703AbbHJQoB (ORCPT ); Mon, 10 Aug 2015 12:44:01 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:34075 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbbHJQn4 (ORCPT ); Mon, 10 Aug 2015 12:43:56 -0400 MIME-Version: 1.0 In-Reply-To: References: <1438725604-22795-1-git-send-email-mcgrof@do-not-panic.com> <1438725604-22795-4-git-send-email-mcgrof@do-not-panic.com> From: "Luis R. Rodriguez" Date: Mon, 10 Aug 2015 09:43:36 -0700 X-Google-Sender-Auth: YIgnUi7qXSv9CFKTuhKYbdSO9wo Message-ID: Subject: Re: [PATCH 3/4] firmware: fold successful fw read early To: Ming Lei Cc: Greg Kroah-Hartman , Jonathan Corbet , Linux Kernel Mailing List , "linux-doc@vger.kernel.org" , David Woodhouse , David Howells , Seth Forshee , Rusty Russell , Michal Marek , Matthew Garrett , Kyle McMartin , linux-security-module , keyrings@linux-nfs.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 9, 2015 at 6:29 AM, Ming Lei wrote: > 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. This is true but I left it as it makes the next patch easier to read and follow. >> + } else >> dev_warn(device, "system data, attempted to load %s, but failed with error %d\n", >> path, rc); >> - else >> - break; >> } >> +out: >> __putname(path); Luis