From: Markus Elfring <[email protected]>
Date: Fri, 29 Dec 2017 17:21:23 +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
Improve a size determination
Delete an unnecessary variable initialisation
drivers/parport/parport_ax88796.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--
2.15.1
From: Markus Elfring <[email protected]>
Date: Fri, 29 Dec 2017 17:00:14 +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/parport/parport_ax88796.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 2fc91edb058d..ef0aec4b55f3 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -281,10 +281,8 @@ static int parport_ax88796_probe(struct platform_device *pdev)
int ret;
dd = kzalloc(sizeof(struct ax_drvdata), GFP_KERNEL);
- if (dd == NULL) {
- dev_err(_dev, "no memory for private data\n");
+ if (!dd)
return -ENOMEM;
- }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
--
2.15.1
From: Markus Elfring <[email protected]>
Date: Fri, 29 Dec 2017 17:03:30 +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/parport/parport_ax88796.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index ef0aec4b55f3..09788d8cf467 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -280,7 +280,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
int irq;
int ret;
- dd = kzalloc(sizeof(struct ax_drvdata), GFP_KERNEL);
+ dd = kzalloc(sizeof(*dd), GFP_KERNEL);
if (!dd)
return -ENOMEM;
--
2.15.1
From: Markus Elfring <[email protected]>
Date: Fri, 29 Dec 2017 17:08:47 +0100
The local variable "pp" will eventually be set to an appropriate pointer
a bit later. Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/parport/parport_ax88796.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 09788d8cf467..bfe97c2a8d4c 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -273,7 +273,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
{
struct device *_dev = &pdev->dev;
struct ax_drvdata *dd;
- struct parport *pp = NULL;
+ struct parport *pp;
struct resource *res;
unsigned long size;
int spacing;
--
2.15.1