linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] as102_fe: Adjustments for as102_attach()
@ 2017-08-29 19:43 SF Markus Elfring
  2017-08-29 19:44 ` [PATCH 1/2] [media] as102_fe: Delete an error message for a failed memory allocation in as102_attach() SF Markus Elfring
  2017-08-29 19:45 ` [media] as102_fe: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-29 19:43 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] [media] as102_fe: Delete an error message for a failed memory allocation in as102_attach()
  2017-08-29 19:43 [PATCH 0/2] [media] as102_fe: Adjustments for as102_attach() SF Markus Elfring
@ 2017-08-29 19:44 ` SF Markus Elfring
  2017-08-29 19:45 ` [media] as102_fe: Improve a size determination " SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-29 19:44 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/dvb-frontends/as102_fe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/as102_fe.c b/drivers/media/dvb-frontends/as102_fe.c
index 98d575f2744c..1fb4ab21d786 100644
--- a/drivers/media/dvb-frontends/as102_fe.c
+++ b/drivers/media/dvb-frontends/as102_fe.c
@@ -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;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [media] as102_fe: Improve a size determination in as102_attach()
  2017-08-29 19:43 [PATCH 0/2] [media] as102_fe: Adjustments for as102_attach() SF Markus Elfring
  2017-08-29 19:44 ` [PATCH 1/2] [media] as102_fe: Delete an error message for a failed memory allocation in as102_attach() SF Markus Elfring
@ 2017-08-29 19:45 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-29 19:45 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/dvb-frontends/as102_fe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/as102_fe.c b/drivers/media/dvb-frontends/as102_fe.c
index 1fb4ab21d786..b1c84ee914f0 100644
--- a/drivers/media/dvb-frontends/as102_fe.c
+++ b/drivers/media/dvb-frontends/as102_fe.c
@@ -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;
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-29 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 19:43 [PATCH 0/2] [media] as102_fe: Adjustments for as102_attach() SF Markus Elfring
2017-08-29 19:44 ` [PATCH 1/2] [media] as102_fe: Delete an error message for a failed memory allocation in as102_attach() SF Markus Elfring
2017-08-29 19:45 ` [media] as102_fe: Improve a size determination " SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).