Skip to contentSkip to conversation

Remove unnecessary null pointer checks?

Cocci Applied SF Markus Elfring 178 participants 1,551 messages Feb 21, 2014 – Apr 12, 2017 3 messages not in the archive Page 7 of 7

Subsystems (270)
lore
Share & tools
lore
#1399 lore raw

Re: [PATCH] staging: ks7010: Adjust dev_err() calls in ks7010_sdio_probe()

In reply to Greg Kroah-Hartman
Quoted 56 lines · Greg Kroah-Hartman
Quoted 38 lines · Tobin C. Harding
Quoted 37 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 11 Apr 2017 14:54:35 +0200

The use of the logging function "dev_err" was introduced here on 2016-09-26.

I find the following implementation details worth for another look.
* Reduce expressions for the first input parameter "dev".

* Omit an extra module prefix in passed error messages because the device name will be displayed by the function "__dev_printk".

Fixes 9887b5e51fafaf919601ccb8bdae1e0ad749032f ("staging: ks7010: Fix warnings on printk() usage")
---
 drivers/staging/ks7010/ks7010_sdio.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +2 -3
index b16618b41253..85feb170869b 100644
@@ -955,12 +955,11 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 	/* private memory allocate */
 	netdev = alloc_etherdev(sizeof(*priv));
 	if (!netdev) {
-		dev_err(&card->func->dev, "ks7010 : Unable to alloc new net device\n");
+		dev_err(&func->dev, "Unable to alloc new net device\n");
 		goto err_release_irq;
 	}
 	if (dev_alloc_name(netdev, "wlan%d") < 0) {
-		dev_err(&card->func->dev,
-			"ks7010 :  Couldn't get name!\n");
+		dev_err(&func->dev, "Couldn't get name!\n");
 		goto err_free_netdev;
 	}
 
Quoted 16 lines

drivers/staging/ks7010/ks7010_sdio.c static int ks7010_sdio_probe(struct sdio_func *func, · line 1006

Quoted 12 lines
drivers/staging/ks7010/ks7010_sdio.c +3 -3
@@ -1000,9 +999,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 	/* Upload firmware */
 	ret = ks7010_upload_firmware(priv, card);	/* firmware load */
 	if (ret) {
-		dev_err(&card->func->dev,
-			"ks7010: firmware load failed !! return code = %d\n",
-			 ret);
+		dev_err(&func->dev,
+			"firmware load failed! return code = %d\n",
+			ret);
 		goto err_free_read_buf;
 	}

This patch does not apply to Greg's staging-testing branch. Sorry Markus a patch was merged the same day you submitted this one that refactored this code.

Quoted 3 lines

Note, Markus is in almost all maintainers kill-file, so we don't even see their emails, and I'd recommend you not even worry about them either.

I've never heard of a kill-file, it sounds awesome. I hope to some day have one of those myself. I settled for a incoming mail rule deleting his email.

thanks for the tip,
Tobin.

#1400 lore raw

Re: [PATCH] staging: ks7010: Adjust dev_err() calls in ks7010_sdio_probe()

Quoted 57 lines · Tobin C. Harding
Quoted 56 lines · Greg Kroah-Hartman
Quoted 54 lines · Tobin C. Harding
Quoted 39 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 11 Apr 2017 14:54:35 +0200

The use of the logging function "dev_err" was introduced here on 2016-09-26.

I find the following implementation details worth for another look.
* Reduce expressions for the first input parameter "dev".

* Omit an extra module prefix in passed error messages because the device name will be displayed by the function "__dev_printk".

Fixes 9887b5e51fafaf919601ccb8bdae1e0ad749032f ("staging: ks7010: Fix warnings on printk() usage")
---
 drivers/staging/ks7010/ks7010_sdio.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +2 -3
index b16618b41253..85feb170869b 100644
@@ -955,12 +955,11 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 	/* private memory allocate */
 	netdev = alloc_etherdev(sizeof(*priv));
 	if (!netdev) {
-		dev_err(&card->func->dev, "ks7010 : Unable to alloc new net device\n");
+		dev_err(&func->dev, "Unable to alloc new net device\n");
 		goto err_release_irq;
 	}
 	if (dev_alloc_name(netdev, "wlan%d") < 0) {
-		dev_err(&card->func->dev,
-			"ks7010 :  Couldn't get name!\n");
+		dev_err(&func->dev, "Couldn't get name!\n");
 		goto err_free_netdev;
 	}
 
@@ -1000,9 +999,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 	/* Upload firmware */

drivers/staging/ks7010/ks7010_sdio.c static int ks7010_sdio_probe(struct sdio_func *func, · line 1006

Quoted 10 lines
drivers/staging/ks7010/ks7010_sdio.c +3 -3
 	ret = ks7010_upload_firmware(priv, card);	/* firmware load */
 	if (ret) {
-		dev_err(&card->func->dev,
-			"ks7010: firmware load failed !! return code = %d\n",
-			 ret);
+		dev_err(&func->dev,
+			"firmware load failed! return code = %d\n",
+			ret);
 		goto err_free_read_buf;
 	}

This patch does not apply to Greg's staging-testing branch. Sorry Markus a patch was merged the same day you submitted this one that refactored this code.

Quoted 7 lines
Quoted 3 lines

Note, Markus is in almost all maintainers kill-file, so we don't even see their emails, and I'd recommend you not even worry about them either.

I've never heard of a kill-file, it sounds awesome. I hope to some day have one of those myself. I settled for a incoming mail rule deleting his email.

Ah, you now have implemented your own, nice work!

https://en.wikipedia.org/wiki/Kill_file