Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1327200
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3.1] firmware: clean up filesystem load exit path |
| Date | 2016-02-04 22:20 +0100 |
| Message-ID | <qYztL-7sP-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[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
csiph-web