Skip to contentSkip to conversation

GPIO-Timberdale: Adjustments for timbgpio_probe()

PATCH In review SF Markus Elfring 2 participants 5 messages Feb 10, 2018 – Feb 22, 2018

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

cover GPIO-Timberdale: Adjustments for timbgpio_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 10 Feb 2018 21:28:29 +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/gpio/gpio-timberdale.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.16.1
#1 lore raw

PATCH 1/2 gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 10 Feb 2018 21:09:08 +0100

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

This issue was detected by using the Coccinelle software.

---
 drivers/gpio/gpio-timberdale.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpio-timberdale.c +2 -3
index 181f86ce00cd..ff155e437210 100644
@@ -239,10 +239,9 @@ static int timbgpio_probe(struct platform_device *pdev)
 	}
 
 	tgpio = devm_kzalloc(dev, sizeof(struct timbgpio), GFP_KERNEL);
-	if (!tgpio) {
-		dev_err(dev, "Memory alloc failed\n");
+	if (!tgpio)
 		return -EINVAL;
-	}
+
 	tgpio->irq_base = pdata->irq_base;
 
 	spin_lock_init(&tgpio->lock);
Signature · 1 line
2.16.1
#2 lore raw

Re: [PATCH 1/2] gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe()

Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 10 Feb 2018 21:09:08 +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 gpio: timberdale: Improve a size determination in timbgpio_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 10 Feb 2018 21:13:28 +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/gpio/gpio-timberdale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-timberdale.c +1 -1
index ff155e437210..6520a8475910 100644
@@ -238,7 +238,7 @@ static int timbgpio_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	tgpio = devm_kzalloc(dev, sizeof(struct timbgpio), GFP_KERNEL);
+	tgpio = devm_kzalloc(dev, sizeof(*tgpio), GFP_KERNEL);
 	if (!tgpio)
 		return -EINVAL;
 
Signature · 1 line
2.16.1
#4 lore raw

Re: [PATCH 2/2] gpio: timberdale: Improve a size determination in timbgpio_probe()

Quoted 10 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 10 Feb 2018 21:13:28 +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