mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] parport-AX88796: Adjustments for parport_ax88796_probe()
@ 2017-12-29 16:25 SF Markus Elfring
  2017-12-29 16:26 ` [PATCH 1/3] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-29 16:25 UTC (permalink / raw)
  To: kernel-janitors, Sudip Mukherjee; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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

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

* [PATCH 1/3] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2017-12-29 16:25 [PATCH 0/3] parport-AX88796: Adjustments for parport_ax88796_probe() SF Markus Elfring
@ 2017-12-29 16:26 ` SF Markus Elfring
  2017-12-29 16:27 ` [PATCH 2/3] parport: ax88796: Improve a size determination " SF Markus Elfring
  2017-12-29 16:28 ` [PATCH 3/3] parport: ax88796: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-29 16:26 UTC (permalink / raw)
  To: kernel-janitors, Sudip Mukherjee; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

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

* [PATCH 2/3] parport: ax88796: Improve a size determination in parport_ax88796_probe()
  2017-12-29 16:25 [PATCH 0/3] parport-AX88796: Adjustments for parport_ax88796_probe() SF Markus Elfring
  2017-12-29 16:26 ` [PATCH 1/3] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() SF Markus Elfring
@ 2017-12-29 16:27 ` SF Markus Elfring
  2017-12-29 16:28 ` [PATCH 3/3] parport: ax88796: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-29 16:27 UTC (permalink / raw)
  To: kernel-janitors, Sudip Mukherjee; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

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

* [PATCH 3/3] parport: ax88796: Delete an unnecessary variable initialisation in parport_ax88796_probe()
  2017-12-29 16:25 [PATCH 0/3] parport-AX88796: Adjustments for parport_ax88796_probe() SF Markus Elfring
  2017-12-29 16:26 ` [PATCH 1/3] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() SF Markus Elfring
  2017-12-29 16:27 ` [PATCH 2/3] parport: ax88796: Improve a size determination " SF Markus Elfring
@ 2017-12-29 16:28 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-29 16:28 UTC (permalink / raw)
  To: kernel-janitors, Sudip Mukherjee; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

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

end of thread, other threads:[~2017-12-29 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-29 16:25 [PATCH 0/3] parport-AX88796: Adjustments for parport_ax88796_probe() SF Markus Elfring
2017-12-29 16:26 ` [PATCH 1/3] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() SF Markus Elfring
2017-12-29 16:27 ` [PATCH 2/3] parport: ax88796: Improve a size determination " SF Markus Elfring
2017-12-29 16:28 ` [PATCH 3/3] parport: ax88796: Delete an unnecessary variable initialisation " 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®