as102_fe: Adjustments for as102_attach()
Subsystems (2)
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
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
@@ -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
[media] as102_fe: Improve a size determination in as102_attach()
In reply to SF Markus ElfringFrom: 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
@@ -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