Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327200 > unrolled thread

[PATCH v3.1] firmware: clean up filesystem load exit path

Started byKees Cook <keescook@chromium.org>
First post2016-02-04 22:20 +0100
Last post2016-02-05 01:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3.1] firmware: clean up filesystem load exit path Kees Cook <keescook@chromium.org> - 2016-02-04 22:20 +0100
    Re: [PATCH v3.1] firmware: clean up filesystem load exit path "Luis R. Rodriguez" <mcgrof@suse.com> - 2016-02-04 23:10 +0100
      Re: [PATCH v3.1] firmware: clean up filesystem load exit path Mimi Zohar <zohar@linux.vnet.ibm.com> - 2016-02-05 01:00 +0100

#1327200 — [PATCH v3.1] firmware: clean up filesystem load exit path

FromKees Cook <keescook@chromium.org>
Date2016-02-04 22:20 +0100
Subject[PATCH v3.1] firmware: clean up filesystem load exit path
Message-ID<qYztL-7sP-5@gated-at.bofh.it>
This makes the error and success paths more readable while trying to
load firmware from the filesystem.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
---
Suggested as an alternative to "[PATCH v3 06/22] firmware: fold successful fw read early"
---
 drivers/base/firmware_class.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 62e052b50aa9..484afbd783f8 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -352,19 +352,17 @@ static int fw_get_filesystem_firmware(struct device *device,
 			continue;
 		rc = fw_read_file_contents(file, buf);
 		fput(file);
-		if (rc)
+		if (rc) {
 			dev_warn(device, "loading %s failed with error %d\n",
 				path, rc);
-		else
-			break;
-	}
-	__putname(path);
-
-	if (!rc) {
+			continue;
+		}
 		dev_dbg(device, "direct-loading %s\n",
 			buf->fw_id);
 		fw_finish_direct_load(device, buf);
+		break;
 	}
+	__putname(path);
 
 	return rc;
 }
-- 
2.6.3


-- 
Kees Cook
Chrome OS & Brillo Security

[toc] | [next] | [standalone]


#1327223

From"Luis R. Rodriguez" <mcgrof@suse.com>
Date2016-02-04 23:10 +0100
Message-ID<qYAga-84a-15@gated-at.bofh.it>
In reply to#1327200
On Thu, Feb 04, 2016 at 01:15:02PM -0800, Kees Cook wrote:
> This makes the error and success paths more readable while trying to
> load firmware from the filesystem.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Josh Boyer <jwboyer@fedoraproject.org>
> Cc: David Howells <dhowells@redhat.com>
> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
> Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>

Thanks,

Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>

> ---
> Suggested as an alternative to "[PATCH v3 06/22] firmware: fold successful fw read early"

Mimi, feel free to pick up as a replacement in your series.

  Luis

[toc] | [prev] | [next] | [standalone]


#1327360

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2016-02-05 01:00 +0100
Message-ID<qYBYC-AO-11@gated-at.bofh.it>
In reply to#1327223
On Thu, 2016-02-04 at 23:01 +0100, Luis R. Rodriguez wrote:
> On Thu, Feb 04, 2016 at 01:15:02PM -0800, Kees Cook wrote:
> > This makes the error and success paths more readable while trying to
> > load firmware from the filesystem.
> >
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Cc: Josh Boyer <jwboyer@fedoraproject.org>
> > Cc: David Howells <dhowells@redhat.com>
> > Cc: Luis R. Rodriguez <mcgrof@kernel.org>
> > Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
> 
> Thanks,
> 
> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
> 
> > ---
> > Suggested as an alternative to "[PATCH v3 06/22] firmware: fold successful fw read early"
> 
> Mimi, feel free to pick up as a replacement in your series.

Ok, thanks!

Mimi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web