Skip to contentSkip to conversation

as102_fe: Adjustments for as102_attach()

PATCH In review SF Markus Elfring 1 participant 3 messages Aug 29, 2017

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

cover as102_fe: Adjustments for as102_attach()

From: Markus Elfring <[email protected]>
Date: Tue, 29 Aug 2017 21:39:12 +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/dvb-frontends/as102_fe.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

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

From: Markus Elfring <[email protected]>
Date: Tue, 29 Aug 2017 21:26:12 +0200

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

This issue was detected by using the Coccinelle software.

---
 drivers/media/dvb-frontends/as102_fe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/as102_fe.c +2 -3
index 98d575f2744c..1fb4ab21d786 100644
@@ -459,7 +459,6 @@ struct dvb_frontend *as102_attach(const char *name,
-	if (state = NULL) {
-		pr_err("%s: unable to allocate memory for state\n", __func__);
+	if (!state)
 		return NULL;
-	}
+
 	fe = &state->frontend;
 	fe->demodulator_priv = state;
 	state->ops = ops;
Signature · 1 line
2.14.1
#2 lore raw

[media] as102_fe: Improve a size determination in as102_attach()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 29 Aug 2017 21:30:38 +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/dvb-frontends/as102_fe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/as102_fe.c +1 -1
index 1fb4ab21d786..b1c84ee914f0 100644
@@ -455,7 +455,7 @@ struct dvb_frontend *as102_attach(const char *name,
 	struct as102_state *state;
 	struct dvb_frontend *fe;
 
-	state = kzalloc(sizeof(struct as102_state), GFP_KERNEL);
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
 
Signature · 1 line
2.14.1