mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] DRXD: Adjustments for three function implementations
@ 2017-08-30 19:14 SF Markus Elfring
  2017-08-30 19:15 ` [PATCH 1/2] [media] drxd: Delete an error message for a failed memory allocation in load_firmware() SF Markus Elfring
  2017-08-30 19:17 ` [PATCH 2/2] [media] drxd: Adjust a null pointer check in three functions SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-30 19:14 UTC (permalink / raw)
  To: linux-media, Colin Ian King, Mauro Carvalho Chehab,
	Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 30 Aug 2017 21:10: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 in load_firmware()
  Adjust a null pointer check in three functions

 drivers/media/dvb-frontends/drxd_hard.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] drxd: Delete an error message for a failed memory allocation in load_firmware()
  2017-08-30 19:14 [PATCH 0/2] [media] DRXD: Adjustments for three function implementations SF Markus Elfring
@ 2017-08-30 19:15 ` SF Markus Elfring
  2017-08-30 19:17 ` [PATCH 2/2] [media] drxd: Adjust a null pointer check in three functions SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-30 19:15 UTC (permalink / raw)
  To: linux-media, Colin Ian King, Mauro Carvalho Chehab,
	Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 30 Aug 2017 20:47: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/drxd_hard.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
index 7d04400b18dd..47b0d37e70ba 100644
--- a/drivers/media/dvb-frontends/drxd_hard.c
+++ b/drivers/media/dvb-frontends/drxd_hard.c
@@ -911,7 +911,6 @@ static int load_firmware(struct drxd_state *state, const char *fw_name)
 	state->microcode = kmemdup(fw->data, fw->size, GFP_KERNEL);
 	if (state->microcode == NULL) {
 		release_firmware(fw);
-		printk(KERN_ERR "drxd: firmware load failure: no memory\n");
 		return -ENOMEM;
 	}
 
-- 
2.14.1

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

* [PATCH 2/2] [media] drxd: Adjust a null pointer check in three functions
  2017-08-30 19:14 [PATCH 0/2] [media] DRXD: Adjustments for three function implementations SF Markus Elfring
  2017-08-30 19:15 ` [PATCH 1/2] [media] drxd: Delete an error message for a failed memory allocation in load_firmware() SF Markus Elfring
@ 2017-08-30 19:17 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-30 19:17 UTC (permalink / raw)
  To: linux-media, Colin Ian King, Mauro Carvalho Chehab,
	Max Kellermann, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 30 Aug 2017 20:55:17 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

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

diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
index 47b0d37e70ba..3bdf9b1f4e7c 100644
--- a/drivers/media/dvb-frontends/drxd_hard.c
+++ b/drivers/media/dvb-frontends/drxd_hard.c
@@ -328,7 +328,7 @@ static int WriteTable(struct drxd_state *state, u8 * pTable)
 {
 	int status = 0;
 
-	if (pTable == NULL)
+	if (!pTable)
 		return 0;
 
 	while (!status) {
@@ -909,7 +909,7 @@ static int load_firmware(struct drxd_state *state, const char *fw_name)
 	}
 
 	state->microcode = kmemdup(fw->data, fw->size, GFP_KERNEL);
-	if (state->microcode == NULL) {
+	if (!state->microcode) {
 		release_firmware(fw);
 		return -ENOMEM;
 	}
@@ -2629,7 +2629,7 @@ static int DRXD_init(struct drxd_state *state, const u8 *fw, u32 fw_size)
 			break;
 
 		/* Apply I2c address patch to B1 */
-		if (!state->type_A && state->m_HiI2cPatch != NULL) {
+		if (!state->type_A && state->m_HiI2cPatch) {
 			status = WriteTable(state, state->m_HiI2cPatch);
 			if (status < 0)
 				break;
-- 
2.14.1

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 19:14 [PATCH 0/2] [media] DRXD: Adjustments for three function implementations SF Markus Elfring
2017-08-30 19:15 ` [PATCH 1/2] [media] drxd: Delete an error message for a failed memory allocation in load_firmware() SF Markus Elfring
2017-08-30 19:17 ` [PATCH 2/2] [media] drxd: Adjust a null pointer check in three functions 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

Powered by JetHome