Skip to contentSkip to conversation

FC0012: Adjustments for fc0012_attach()

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

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

cover FC0012: Adjustments for fc0012_attach()

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 18:03:21 +0200

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

Markus Elfring (2):
Delete an error message for a failed memory allocation Improve a size determination

 drivers/media/tuners/fc0012.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 fc0012: Delete an error message for a failed memory allocation in fc0012_attach()

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 17:47:52 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/tuners/fc0012.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/tuners/fc0012.c +0 -1
index 625ac6f51c39..7126dd1d5151 100644
@@ -449,6 +449,5 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
 	if (!priv) {
 		ret = -ENOMEM;
-		dev_err(&i2c->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME);
 		goto err;
 	}
 
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/2 fc0012: Improve a size determination in fc0012_attach()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 17:55:27 +0200

Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

---
 drivers/media/tuners/fc0012.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/tuners/fc0012.c +1 -1
index 7126dd1d5151..c008513bd64a 100644
@@ -445,5 +445,5 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
 	if (fe->ops.i2c_gate_ctrl)
 		fe->ops.i2c_gate_ctrl(fe, 1);
 
-	priv = kzalloc(sizeof(struct fc0012_priv), GFP_KERNEL);
+	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv) {
Signature · 1 line
2.14.1