GPIO-Timberdale: Adjustments for timbgpio_probe()
Subsystems (2)
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
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
@@ -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
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 +0100Omit 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]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/2 gpio: timberdale: Improve a size determination in timbgpio_probe()
In reply to SF Markus ElfringFrom: 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
@@ -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
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 +0100Replace 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]>
Patch applied.
Yours,
Linus Walleij