From: Markus Elfring <[email protected]>
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
From: Markus Elfring <[email protected]>
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 <[email protected]>
---
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
From: Markus Elfring <[email protected]>
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 <[email protected]>
---
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
From: Markus Elfring <[email protected]>
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 <[email protected]>
---
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