Skip to contentSkip to conversation

firmware: hardcode the debug message for -ENOENT

PATCH Superseded [email protected] 2 participants 7 messages Jan 14, 2019 – Feb 21, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: hardcode the debug message for -ENOENT

From d6892f54a81bf85ad011bfb8822567690713d575 Mon Sep 17 00:00:00 2001

When the return code of "-ENOENT" was printed inside of the debug message, which could be hardcoded simply.

---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +4 -4
index 8e9213b..9ab1409 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv)
 		rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
 						msize, id);
 		if (rc) {
-			if (rc == -ENOENT)
-				dev_dbg(device, "loading %s failed with error %d\n",
-					 path, rc);
-			else
+			if (rc != -ENOENT)
 				dev_warn(device, "loading %s failed with error %d\n",
 					 path, rc);
+			else
+				dev_dbg(device, "loading %s failed with error -ENOENT\n",
+					 path);
 			continue;
 		}
 		dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Refined at below.

From bbd0d9c8f28eb78ca34353347c3d4092e88f000c Mon Sep 17 00:00:00 2001

When the return code of "-ENOENT" was printed inside of the debug message, which could be hardcoded meaningfully.

---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +0 -0
index 8e9213b..7eaaf5e 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv)
                rc = kernel_read_file_from_path(path, &fw_priv->data, 

&size,

                                                msize, id);
                if (rc) {

- if (rc == -ENOENT)
- dev_dbg(device, "loading %s failed with error %d\n",
- path, rc);
- else
+ if (rc != -ENOENT)
dev_warn(device, "loading %s failed with
error %d\n",

                                         path, rc);
+                       else
+                               dev_dbg(device, "loading %s failed for no such file or directory.\n",
+                                        path);
                        continue;
                }
                dev_dbg(device, "direct-loading %s\n", 

fw_priv->fw_name);

Signature · 1 line
2.7.4
Quoted 2 lines · On 2019-01-14 03:19 PM, [email protected] wrote:

From d6892f54a81bf85ad011bfb8822567690713d575 Mon Sep 17 00:00:00 2001

maintainer
#2 lore raw
Quoted 5 lines · On Mon, Jan 14, 2019 at 05:58:30PM +0800, [email protected] wrote:

Hi,

Refined at below.

From bbd0d9c8f28eb78ca34353347c3d4092e88f000c Mon Sep 17 00:00:00 2001

This is all garbled, not sure why your patch looks all messed up.

Are you using git sendemail or something manual?

Luis

Quoted 42 lines

When the return code of "-ENOENT" was printed inside of the debug message, which could be hardcoded meaningfully.

---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +3 -4
index 8e9213b..7eaaf5e 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device,
 struct fw_priv *fw_priv)
                rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
                                                msize, id);
                if (rc) {
-                       if (rc == -ENOENT)
-                               dev_dbg(device, "loading %s failed with
 error %d\n",
-                                        path, rc);
-                       else
+                       if (rc != -ENOENT)
                                dev_warn(device, "loading %s failed with
 error %d\n",
                                         path, rc);
+                       else
+                               dev_dbg(device, "loading %s failed for no

such file or directory.\n",

+                                        path);
                        continue;
                }
                dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);
Signature · 1 line
2.7.4
Quoted 2 lines · On 2019-01-14 03:19 PM, [email protected] wrote:

From d6892f54a81bf85ad011bfb8822567690713d575 Mon Sep 17 00:00:00 2001

#3 lore raw
Quoted 5 lines · Luis Chamberlain
Quoted 4 lines · On Mon, Jan 14, 2019 at 05:58:30PM +0800, [email protected] wrote:

Hi,

Refined at below.

Quoted 8 lines
Quoted 1 line

From bbd0d9c8f28eb78ca34353347c3d4092e88f000c Mon Sep 17 00:00:00 2001

This is all garbled, not sure why your patch looks all messed up.

Are you using git sendemail or something manual?

Luis

Done. Update it with resend it as below.

From: John Zhao <[email protected]>

When the return code of "-ENOENT" was printed inside of the debug message, which could be hardcoded meaningful.

---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +4 -4
index 8e9213b..7eaaf5e 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv)
 		rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
 						msize, id);
 		if (rc) {
-			if (rc == -ENOENT)
-				dev_dbg(device, "loading %s failed with error %d\n",
-					 path, rc);
-			else
+			if (rc != -ENOENT)
 				dev_warn(device, "loading %s failed with error %d\n",
 					 path, rc);
+			else
+				dev_dbg(device, "loading %s failed for no such file or directory.\n",
+					 path);
 			continue;
 		}
 		dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);
Signature · 1 line
2.7.4
maintainer
#4 lore raw
Quoted 8 lines · On Sun, Feb 17, 2019 at 04:25:10PM +0800, [email protected] wrote:
Quoted 7 lines · Luis Chamberlain
Quoted 5 lines · On Mon, Jan 14, 2019 at 05:58:30PM +0800, [email protected] wrote:

Hi,

Refined at below.

From bbd0d9c8f28eb78ca34353347c3d4092e88f000c Mon Sep 17 00:00:00 2001

Quoted 7 lines
Quoted 6 lines

This is all garbled, not sure why your patch looks all messed up.

Are you using git sendemail or something manual?

Luis

Done. Update it with resend it as below.

Sorry but I have not received it, can you resend?
While at it please address my comment below.

Quoted 4 lines

From: John Zhao <[email protected]>

When the return code of "-ENOENT" was printed inside of the debug message, which could be hardcoded meaningful.

This sentence doesn't read well. Please adjust it a bit to make coherent sense, and resend it.

Perhaps you can use something like this:

We already issue a custom firmware debug print message when no file / path was not found, however only the error code is returned. Stating clearly that the file was not found is much more useful for debugging, so let's be explicit about that.

Luis

Quoted 31 lines
---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +4 -4
index 8e9213b..7eaaf5e 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device,
 struct fw_priv *fw_priv)
 		rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
 						msize, id);
 		if (rc) {
-			if (rc == -ENOENT)
-				dev_dbg(device, "loading %s failed with error %d\n",
-					 path, rc);
-			else
+			if (rc != -ENOENT)
 				dev_warn(device, "loading %s failed with error %d\n",
 					 path, rc);
+			else
+				dev_dbg(device, "loading %s failed for no such file or directory.\n",
+					 path);
 			continue;
 		}

dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);

Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 1/1 firmware: hardcode the debug message for -ENOENT

From: John Zhao <[email protected]>

When no file /path was found, the error code of -ENOENT enumerated in errno-base.h, is returned. Stating clearly that the file was not found is much more useful for debugging, So let's be explicit about that.

---
 drivers/base/firmware_loader/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/firmware_loader/main.c +4 -4
index 8e9213b..7eaaf5e 100644
@@ -328,12 +328,12 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv)
 		rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
 						msize, id);
 		if (rc) {
-			if (rc == -ENOENT)
-				dev_dbg(device, "loading %s failed with error %d\n",
-					 path, rc);
-			else
+			if (rc != -ENOENT)
 				dev_warn(device, "loading %s failed with error %d\n",
 					 path, rc);
+			else
+				dev_dbg(device, "loading %s failed for no such file or directory.\n",
+					 path);
 			continue;
 		}
 		dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);
maintainer Acked-by on v2 1/1
#6 lore raw
Quoted 8 lines · On Wed, Feb 20, 2019 at 10:39:04AM +0800, [email protected] wrote:

From: John Zhao <[email protected]>

When no file /path was found, the error code of -ENOENT enumerated in errno-base.h, is returned. Stating clearly that the file was not found is much more useful for debugging, So let's be explicit about that.

Luis