Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739795

[PATCH 2/6] [media] tda8261: Improve a size determination in tda8261_attach()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/6] [media] tda8261: Improve a size determination in tda8261_attach()
Date 2017-09-26 13:30 +0200
Message-ID <utWdR-46A-29@gated-at.bofh.it> (permalink)
References <utWdQ-46A-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 12:06:19 +0200

* The script "checkpatch.pl" pointed information out like the following.

  ERROR: do not use assignment in if condition

  Thus fix an affected source code place.

* 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.

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

diff --git a/drivers/media/dvb-frontends/tda8261.c b/drivers/media/dvb-frontends/tda8261.c
index 5a8a9b6b8107..5269a170c84e 100644
--- a/drivers/media/dvb-frontends/tda8261.c
+++ b/drivers/media/dvb-frontends/tda8261.c
@@ -185,7 +185,8 @@ struct dvb_frontend *tda8261_attach(struct dvb_frontend *fe,
 {
 	struct tda8261_state *state = NULL;
 
-	if ((state = kzalloc(sizeof (struct tda8261_state), GFP_KERNEL)) == NULL)
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
+	if (!state)
 		goto exit;
 
 	state->config		= config;
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] [media] TDA8261: Fine-tuning for five function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:30 +0200
  [PATCH 1/6] [media] tda8261: Use common error handling code in  tda8261_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:30 +0200
    Re: [PATCH 1/6] [media] tda8261: Use common error handling code in  tda8261_set_params() Christoph Böhmwalder <christoph@boehmwalder.at> - 2017-09-26 13:50 +0200
      Re: [PATCH 1/6] [media] tda8261: Use common error handling code in  tda8261_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 19:00 +0200
  [PATCH 2/6] [media] tda8261: Improve a size determination in  tda8261_attach() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:30 +0200
  [PATCH 6/6] [media] tda8261: Delete an unnecessary variable  initialisation in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:40 +0200
  [PATCH 4/6] [media] tda8261: Delete an unnecessary variable  initialisation in tda8261_attach() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:40 +0200
  [PATCH 3/6] [media] tda8261: Return directly after a failed kzalloc()  in tda8261_attach() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:40 +0200
  [PATCH 5/6] [media] tda8261: Adjust three function calls together  with a variable assignment SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-26 13:40 +0200

csiph-web