Skip to contentSkip to conversation

xc4000: Adjustments for xc4000_fwupload()

PATCH New SF Markus Elfring 1 participant 3 messages Sep 9, 2017

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

cover xc4000: Adjustments for xc4000_fwupload()

From: Markus Elfring <[email protected]>
Date: Sat, 9 Sep 2017 21:00:12 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Delete two error messages for a failed memory allocation Adjust two null pointer checks

 drivers/media/tuners/xc4000.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 xc4000: Delete two error messages for a failed memory allocation in xc4000_fwupload()

From: Markus Elfring <[email protected]>
Date: Sat, 9 Sep 2017 20:46:35 +0200

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/tuners/xc4000.c | 2 --
 1 file changed, 2 deletions(-)
drivers/media/tuners/xc4000.c +0 -2
index e30948e4ff87..bbf386127fc4 100644
@@ -779,4 +779,3 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
-		printk(KERN_ERR "Not enough memory to load firmware file.\n");
 		rc = -ENOMEM;
 		goto done;
 	}
@@ -826,4 +825,3 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
-			printk(KERN_ERR "Not enough memory to load firmware file.\n");
 			rc = -ENOMEM;
 			goto done;
 		}
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/2 xc4000: Adjust two null pointer checks in xc4000_fwupload()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 9 Sep 2017 20:55:14 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

---
 drivers/media/tuners/xc4000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/tuners/xc4000.c +2 -2
index bbf386127fc4..bd53e44b3cc8 100644
@@ -775,5 +775,5 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
 		priv->firm_version >> 8, priv->firm_version & 0xff);
 
 	priv->firm = kcalloc(n_array, sizeof(*priv->firm), GFP_KERNEL);
-	if (priv->firm = NULL) {
+	if (!priv->firm) {
 		rc = -ENOMEM;
@@ -821,5 +821,5 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
 		}
 
 		priv->firm[n].ptr = kzalloc(size, GFP_KERNEL);
-		if (priv->firm[n].ptr = NULL) {
+		if (!priv->firm[n].ptr) {
 			rc = -ENOMEM;
Signature · 1 line
2.14.1