public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one()
@ 2018-01-08 13:07 SF Markus Elfring
  2018-01-08 13:08 ` [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-08 13:07 UTC (permalink / raw)
  To: kernel-janitors, Andy Shevchenko, Anton Vasilyev, Arnd Bergmann,
	Greg Kroah-Hartman, Jiri Kosina
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 14:01:24 +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
  Adjust two function calls together with a variable assignment

 drivers/misc/ibmasm/module.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.15.1

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

* [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one()
  2018-01-08 13:07 [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one() SF Markus Elfring
@ 2018-01-08 13:08 ` SF Markus Elfring
  2018-01-08 13:09 ` [PATCH 2/3] misc/ibmasm: Improve a size determination " SF Markus Elfring
  2018-01-08 13:10 ` [PATCH 3/3] misc/ibmasm: Adjust two function calls together with a variable assignment SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-08 13:08 UTC (permalink / raw)
  To: kernel-janitors, Andy Shevchenko, Anton Vasilyev, Arnd Bergmann,
	Greg Kroah-Hartman, Jiri Kosina
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 13:34:55 +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/ibmasm/module.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index e914b8c80943..d22b3c428ca9 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -80,7 +80,6 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL);
 	if (sp == NULL) {
-		dev_err(&pdev->dev, "Failed to allocate memory\n");
 		result = -ENOMEM;
 		goto error_kmalloc;
 	}
-- 
2.15.1

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

* [PATCH 2/3] misc/ibmasm: Improve a size determination in ibmasm_init_one()
  2018-01-08 13:07 [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one() SF Markus Elfring
  2018-01-08 13:08 ` [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one() SF Markus Elfring
@ 2018-01-08 13:09 ` SF Markus Elfring
  2018-01-08 13:10 ` [PATCH 3/3] misc/ibmasm: Adjust two function calls together with a variable assignment SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-08 13:09 UTC (permalink / raw)
  To: kernel-janitors, Andy Shevchenko, Anton Vasilyev, Arnd Bergmann,
	Greg Kroah-Hartman, Jiri Kosina
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 13:43: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/misc/ibmasm/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index d22b3c428ca9..894397b1ee51 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -78,7 +78,7 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* vnc client won't work without bus-mastering */
 	pci_set_master(pdev);
 
-	sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL);
+	sp = kzalloc(sizeof(*sp), GFP_KERNEL);
 	if (sp == NULL) {
 		result = -ENOMEM;
 		goto error_kmalloc;
-- 
2.15.1

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

* [PATCH 3/3] misc/ibmasm: Adjust two function calls together with a variable assignment
  2018-01-08 13:07 [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one() SF Markus Elfring
  2018-01-08 13:08 ` [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one() SF Markus Elfring
  2018-01-08 13:09 ` [PATCH 2/3] misc/ibmasm: Improve a size determination " SF Markus Elfring
@ 2018-01-08 13:10 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-08 13:10 UTC (permalink / raw)
  To: kernel-janitors, Andy Shevchenko, Anton Vasilyev, Arnd Bergmann,
	Greg Kroah-Hartman, Jiri Kosina
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 13:53:25 +0100

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

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/misc/ibmasm/module.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index 894397b1ee51..f4742044e0d1 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -64,14 +64,16 @@ MODULE_PARM_DESC(ibmasm_debug, " Set debug mode on or off");
 
 static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-	int result;
 	struct service_processor *sp;
+	int result = pci_enable_device(pdev);
 
-	if ((result = pci_enable_device(pdev))) {
+	if (result) {
 		dev_err(&pdev->dev, "Failed to enable PCI device\n");
 		return result;
 	}
-	if ((result = pci_request_regions(pdev, DRIVER_NAME))) {
+
+	result = pci_request_regions(pdev, DRIVER_NAME);
+	if (result) {
 		dev_err(&pdev->dev, "Failed to allocate PCI resources\n");
 		goto error_resources;
 	}
-- 
2.15.1

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-08 13:07 [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one() SF Markus Elfring
2018-01-08 13:08 ` [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one() SF Markus Elfring
2018-01-08 13:09 ` [PATCH 2/3] misc/ibmasm: Improve a size determination " SF Markus Elfring
2018-01-08 13:10 ` [PATCH 3/3] misc/ibmasm: Adjust two function calls together with a variable assignment 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