mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] mtd/nand/ams-delta: Adjustments for three function implementations
@ 2018-01-05 20:27 SF Markus Elfring
  2018-01-05 20:28 ` [PATCH 1/3] mtd/nand/ams-delta: Delete an error message for a failed memory allocation in ams_delta_init() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-05 20:27 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon, Brian Norris, Cyrille Pitchen,
	David Woodhouse, Marek Vasut, Richard Weinberger
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jan 2018 21:21:12 +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 ams_delta_init()
  Improve a size determination in ams_delta_init()
  Add some spaces for better code readability

 drivers/mtd/nand/ams-delta.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.15.1

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

* [PATCH 1/3] mtd/nand/ams-delta: Delete an error message for a failed memory allocation in ams_delta_init()
  2018-01-05 20:27 [PATCH 0/3] mtd/nand/ams-delta: Adjustments for three function implementations SF Markus Elfring
@ 2018-01-05 20:28 ` SF Markus Elfring
  2018-01-05 20:30 ` [PATCH 2/3] mtd/nand/ams-delta: Improve a size determination " SF Markus Elfring
  2018-01-05 20:31 ` [PATCH 3/3] mtd/nand/ams-delta: Add some spaces for better code readability SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-05 20:28 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon, Brian Norris, Cyrille Pitchen,
	David Woodhouse, Marek Vasut, Richard Weinberger
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jan 2018 21:01:18 +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/mtd/nand/ams-delta.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index d60ada45c549..effaecff0f2e 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
 	/* Allocate memory for MTD device structure and private data */
 	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
 	if (!this) {
-		printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n");
 		err = -ENOMEM;
 		goto out;
 	}
-- 
2.15.1

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

* [PATCH 2/3] mtd/nand/ams-delta: Improve a size determination in ams_delta_init()
  2018-01-05 20:27 [PATCH 0/3] mtd/nand/ams-delta: Adjustments for three function implementations SF Markus Elfring
  2018-01-05 20:28 ` [PATCH 1/3] mtd/nand/ams-delta: Delete an error message for a failed memory allocation in ams_delta_init() SF Markus Elfring
@ 2018-01-05 20:30 ` SF Markus Elfring
  2018-01-05 20:31 ` [PATCH 3/3] mtd/nand/ams-delta: Add some spaces for better code readability SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-05 20:30 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon, Brian Norris, Cyrille Pitchen,
	David Woodhouse, Marek Vasut, Richard Weinberger
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jan 2018 21:03:20 +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/mtd/nand/ams-delta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index effaecff0f2e..4f5fc104c510 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -183,7 +183,7 @@ static int ams_delta_init(struct platform_device *pdev)
 		return -ENXIO;
 
 	/* Allocate memory for MTD device structure and private data */
-	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
+	this = kzalloc(sizeof(*this), GFP_KERNEL);
 	if (!this) {
 		err = -ENOMEM;
 		goto out;
-- 
2.15.1

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

* [PATCH 3/3] mtd/nand/ams-delta: Add some spaces for better code readability
  2018-01-05 20:27 [PATCH 0/3] mtd/nand/ams-delta: Adjustments for three function implementations SF Markus Elfring
  2018-01-05 20:28 ` [PATCH 1/3] mtd/nand/ams-delta: Delete an error message for a failed memory allocation in ams_delta_init() SF Markus Elfring
  2018-01-05 20:30 ` [PATCH 2/3] mtd/nand/ams-delta: Improve a size determination " SF Markus Elfring
@ 2018-01-05 20:31 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-05 20:31 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon, Brian Norris, Cyrille Pitchen,
	David Woodhouse, Marek Vasut, Richard Weinberger
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jan 2018 21:14:20 +0100

Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mtd/nand/ams-delta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 4f5fc104c510..9ea61271fee6 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -94,7 +94,7 @@ static void ams_delta_write_buf(struct mtd_info *mtd, const u_char *buf,
 {
 	int i;
 
-	for (i=0; i<len; i++)
+	for (i = 0; i < len; i++)
 		ams_delta_write_byte(mtd, buf[i]);
 }
 
@@ -102,7 +102,7 @@ static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 {
 	int i;
 
-	for (i=0; i<len; i++)
+	for (i = 0; i < len; i++)
 		buf[i] = ams_delta_read_byte(mtd);
 }
 
-- 
2.15.1

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

end of thread, other threads:[~2018-01-05 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 20:27 [PATCH 0/3] mtd/nand/ams-delta: Adjustments for three function implementations SF Markus Elfring
2018-01-05 20:28 ` [PATCH 1/3] mtd/nand/ams-delta: Delete an error message for a failed memory allocation in ams_delta_init() SF Markus Elfring
2018-01-05 20:30 ` [PATCH 2/3] mtd/nand/ams-delta: Improve a size determination " SF Markus Elfring
2018-01-05 20:31 ` [PATCH 3/3] mtd/nand/ams-delta: Add some spaces for better code readability 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