Skip to contentSkip to conversation

C8SECTPFE: Adjustments for c8sectpfe_frontend_attach()

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

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

cover C8SECTPFE: Adjustments for c8sectpfe_frontend_attach()

From: Markus Elfring <[email protected]>
Date: Fri, 15 Sep 2017 17:55:43 +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 two size determinations

 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

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

From: Markus Elfring <[email protected]>
Date: Fri, 15 Sep 2017 17:20:48 +0200

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

This issue was detected by using the Coccinelle software.

---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c +1 -4
index 2c0015b1264d..1b23b188cd65 100644
@@ -166,7 +166,4 @@ int c8sectpfe_frontend_attach(struct dvb_frontend **fe,
 					GFP_KERNEL);
-		if (!tda18212) {
-			dev_err(c8sectpfe->device,
-				"%s: devm_kzalloc failed\n", __func__);
+		if (!tda18212)
 			return -ENOMEM;
-		}
 
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/2 c8sectpfe: Improve two size determinations in c8sectpfe_frontend_attach()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 15 Sep 2017 17:30:38 +0200

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

---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c +2 -4
index 1b23b188cd65..c3b09a9e30ec 100644
@@ -164,12 +164,10 @@ int c8sectpfe_frontend_attach(struct dvb_frontend **fe,
 		tda18212 = devm_kzalloc(c8sectpfe->device,
-					sizeof(struct tda18212_config),
+					sizeof(*tda18212),
 					GFP_KERNEL);
 		if (!tda18212)
 			return -ENOMEM;
 
-		memcpy(tda18212, &tda18212_conf,
-			sizeof(struct tda18212_config));
-
+		memcpy(tda18212, &tda18212_conf, sizeof(*tda18212));
 		tda18212->fe = (*fe);
 
 		tda18212_info.platform_data = tda18212;
Signature · 1 line
2.14.1