All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] [media] cx24113: Adjustments for cx24113_attach()
@ 2017-08-29 20:30 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:30 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:23:45 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete an error message for a failed memory allocation
  Return directly after a failed kzalloc()
  Improve a size determination

 drivers/media/dvb-frontends/cx24113.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.14.1

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

* [PATCH 0/3] [media] cx24113: Adjustments for cx24113_attach()
@ 2017-08-29 20:30 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:30 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:23:45 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete an error message for a failed memory allocation
  Return directly after a failed kzalloc()
  Improve a size determination

 drivers/media/dvb-frontends/cx24113.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.14.1


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

* [PATCH 1/3] [media] cx24113: Delete an error message for a failed memory allocation in cx24113_attach()
  2017-08-29 20:30 ` SF Markus Elfring
@ 2017-08-29 20:31   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:31 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:08:09 +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/cx24113.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 0118c2658cf7..8fc7333c76b7 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -557,8 +557,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 	int rc;
-	if (state == NULL) {
-		cx_err("Unable to kzalloc\n");
+
+	if (!state)
 		goto error;
-	}
 
 	/* setup the state */
 	state->config = config;
-- 
2.14.1

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

* [PATCH 1/3] [media] cx24113: Delete an error message for a failed memory allocation in cx24113_attac
@ 2017-08-29 20:31   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:31 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:08:09 +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/cx24113.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 0118c2658cf7..8fc7333c76b7 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -557,8 +557,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 	int rc;
-	if (state = NULL) {
-		cx_err("Unable to kzalloc\n");
+
+	if (!state)
 		goto error;
-	}
 
 	/* setup the state */
 	state->config = config;
-- 
2.14.1


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

* [PATCH 2/3] [media] cx24113: Return directly after a failed kzalloc() in cx24113_attach()
  2017-08-29 20:30 ` SF Markus Elfring
@ 2017-08-29 20:32   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:32 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:10:49 +0200

Return directly after a call of the function "kzalloc" failed
at the beginning.

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

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 8fc7333c76b7..09c3fd1840f2 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -557,7 +557,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 	int rc;
 
 	if (!state)
-		goto error;
+		return NULL;
 
 	/* setup the state */
 	state->config = config;
-- 
2.14.1

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

* [PATCH 2/3] [media] cx24113: Return directly after a failed kzalloc() in cx24113_attach()
@ 2017-08-29 20:32   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:32 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:10:49 +0200

Return directly after a call of the function "kzalloc" failed
at the beginning.

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

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 8fc7333c76b7..09c3fd1840f2 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -557,7 +557,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 	int rc;
 
 	if (!state)
-		goto error;
+		return NULL;
 
 	/* setup the state */
 	state->config = config;
-- 
2.14.1


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

* [media] cx24113: Improve a size determination in cx24113_attach()
  2017-08-29 20:30 ` SF Markus Elfring
@ 2017-08-29 20:33   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:33 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:17:25 +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.

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

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 09c3fd1840f2..ee1f704f81f2 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -552,8 +552,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 		const struct cx24113_config *config, struct i2c_adapter *i2c)
 {
 	/* allocate memory for the internal state */
-	struct cx24113_state *state =
-		kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
+	struct cx24113_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
 	int rc;
 
 	if (!state)
-- 
2.14.1

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

* [media] cx24113: Improve a size determination in cx24113_attach()
@ 2017-08-29 20:33   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-08-29 20:33 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab, Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 22:17:25 +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.

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

diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c
index 09c3fd1840f2..ee1f704f81f2 100644
--- a/drivers/media/dvb-frontends/cx24113.c
+++ b/drivers/media/dvb-frontends/cx24113.c
@@ -552,8 +552,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 		const struct cx24113_config *config, struct i2c_adapter *i2c)
 {
 	/* allocate memory for the internal state */
-	struct cx24113_state *state -		kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
+	struct cx24113_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
 	int rc;
 
 	if (!state)
-- 
2.14.1


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 20:30 [PATCH 0/3] [media] cx24113: Adjustments for cx24113_attach() SF Markus Elfring
2017-08-29 20:30 ` SF Markus Elfring
2017-08-29 20:31 ` [PATCH 1/3] [media] cx24113: Delete an error message for a failed memory allocation in cx24113_attach() SF Markus Elfring
2017-08-29 20:31   ` [PATCH 1/3] [media] cx24113: Delete an error message for a failed memory allocation in cx24113_attac SF Markus Elfring
2017-08-29 20:32 ` [PATCH 2/3] [media] cx24113: Return directly after a failed kzalloc() in cx24113_attach() SF Markus Elfring
2017-08-29 20:32   ` SF Markus Elfring
2017-08-29 20:33 ` [media] cx24113: Improve a size determination " SF Markus Elfring
2017-08-29 20:33   ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.