mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations
@ 2018-01-10 15:30 SF Markus Elfring
  2018-01-10 15:32 ` [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-10 15:30 UTC (permalink / raw)
  To: kernel-janitors, Arnd Bergmann, Arvind Yadav, David S. Miller,
	Greg Kroah-Hartman, Johannes Berg, Stephen Hemminger
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 16:26:36 +0100

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

Markus Elfring (3):
  Delete an error message for a failed memory allocation in kim_probe()
  Improve a size determination in kim_probe()
  Delete an unnecessary return statement in two functions

 drivers/misc/ti-st/st_kim.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
2.15.1

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

* [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe()
  2018-01-10 15:30 [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations SF Markus Elfring
@ 2018-01-10 15:32 ` SF Markus Elfring
  2018-01-10 15:33 ` [PATCH 2/3] misc/ti-st: Improve a size determination " SF Markus Elfring
  2018-01-10 15:34 ` [PATCH 3/3] misc/ti-st: Delete an unnecessary return statement in two functions SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-10 15:32 UTC (permalink / raw)
  To: kernel-janitors, Arnd Bergmann, Arvind Yadav, David S. Miller,
	Greg Kroah-Hartman, Johannes Berg, Stephen Hemminger
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 16:04:52 +0100

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/misc/ti-st/st_kim.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index b77aacafc3fc..68ebdf466b17 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -736,10 +736,9 @@ static int kim_probe(struct platform_device *pdev)
 	}
 
 	kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
-	if (!kim_gdata) {
-		pr_err("no mem to allocate");
+	if (!kim_gdata)
 		return -ENOMEM;
-	}
+
 	platform_set_drvdata(pdev, kim_gdata);
 
 	err = st_core_init(&kim_gdata->core_data);
-- 
2.15.1

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

* [PATCH 2/3] misc/ti-st: Improve a size determination in kim_probe()
  2018-01-10 15:30 [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations SF Markus Elfring
  2018-01-10 15:32 ` [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe() SF Markus Elfring
@ 2018-01-10 15:33 ` SF Markus Elfring
  2018-01-10 15:34 ` [PATCH 3/3] misc/ti-st: Delete an unnecessary return statement in two functions SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-10 15:33 UTC (permalink / raw)
  To: kernel-janitors, Arnd Bergmann, Arvind Yadav, David S. Miller,
	Greg Kroah-Hartman, Johannes Berg, Stephen Hemminger
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 16:10:45 +0100

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/misc/ti-st/st_kim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 68ebdf466b17..948e3461d02e 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -735,7 +735,7 @@ static int kim_probe(struct platform_device *pdev)
 		st_kim_devices[0] = pdev;
 	}
 
-	kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
+	kim_gdata = kzalloc(sizeof(*kim_gdata), GFP_ATOMIC);
 	if (!kim_gdata)
 		return -ENOMEM;
 
-- 
2.15.1

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

* [PATCH 3/3] misc/ti-st: Delete an unnecessary return statement in two functions
  2018-01-10 15:30 [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations SF Markus Elfring
  2018-01-10 15:32 ` [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe() SF Markus Elfring
  2018-01-10 15:33 ` [PATCH 2/3] misc/ti-st: Improve a size determination " SF Markus Elfring
@ 2018-01-10 15:34 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-10 15:34 UTC (permalink / raw)
  To: kernel-janitors, Arnd Bergmann, Arvind Yadav, David S. Miller,
	Greg Kroah-Hartman, Johannes Berg, Stephen Hemminger
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 16:16:55 +0100

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

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/misc/ti-st/st_kim.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 948e3461d02e..e33eb4bcb608 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -206,7 +206,6 @@ static void kim_int_recv(struct kim_data_s *kim_gdata,
 		kim_gdata->rx_skb->cb[1] = 0;
 
 	}
-	return;
 }
 
 static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
@@ -436,7 +435,6 @@ void st_kim_recv(void *disc_data, const unsigned char *data, long count)
 	 * from other fw responses when data gathering is complete
 	 */
 	kim_int_recv(kim_gdata, data, count);
-	return;
 }
 
 /* to signal completion of line discipline installation
-- 
2.15.1

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

end of thread, other threads:[~2018-01-10 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 15:30 [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations SF Markus Elfring
2018-01-10 15:32 ` [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe() SF Markus Elfring
2018-01-10 15:33 ` [PATCH 2/3] misc/ti-st: Improve a size determination " SF Markus Elfring
2018-01-10 15:34 ` [PATCH 3/3] misc/ti-st: Delete an unnecessary return statement in two 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

all inboxes | Powered by JetHome®