Skip to contentSkip to conversation

pinctrl/nomadik/abx500: Adjustments for abx500_gpio_probe()

PATCH In review SF Markus Elfring 2 participants 5 messages Dec 20, 2017 – Dec 21, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover pinctrl/nomadik/abx500: Adjustments for abx500_gpio_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 10:45:01 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Delete an error message for a failed memory allocation Improve a size determination

 drivers/pinctrl/nomadik/pinctrl-abx500.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.15.1
#1 lore raw

PATCH 1/2 pinctrl/nomadik/abx500: Delete an error message for a failed memory allocation in abx500_gpio_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 10:12:56 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/pinctrl/nomadik/pinctrl-abx500.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pinctrl/nomadik/pinctrl-abx500.c +1 -4
index b32c0d602024..feb030d1ea63 100644
@@ -1157,11 +1157,8 @@ static int abx500_gpio_probe(struct platform_device *pdev)
 
 	pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl),
 				   GFP_KERNEL);
-	if (pct = NULL) {
-		dev_err(&pdev->dev,
-			"failed to allocate memory for pct\n");
+	if (!pct)
 		return -ENOMEM;
-	}
 
 	pct->dev = &pdev->dev;
 	pct->parent = dev_get_drvdata(pdev->dev.parent);
Signature · 1 line
2.15.1
#2 lore raw

Re: [PATCH 1/2] pinctrl/nomadik/abx500: Delete an error message for a failed memory allocation in abx500_gpio_probe()

Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 10:12:56 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Patch applied.

Yours,
Linus Walleij

#3 lore raw

PATCH 2/2 pinctrl/nomadik/abx500: Improve a size determination in abx500_gpio_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 10:22:53 +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.

---
 drivers/pinctrl/nomadik/pinctrl-abx500.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/nomadik/pinctrl-abx500.c +1 -2
index feb030d1ea63..7d00a5d864f5 100644
@@ -1155,8 +1155,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl),
-				   GFP_KERNEL);
+	pct = devm_kzalloc(&pdev->dev, sizeof(*pct), GFP_KERNEL);
 	if (!pct)
 		return -ENOMEM;
 
Signature · 1 line
2.15.1
#4 lore raw

Re: [PATCH 2/2] pinctrl/nomadik/abx500: Improve a size determination in abx500_gpio_probe()

Quoted 10 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 10:22:53 +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.

Patch applied.

Yours,
Linus Walleij