gpio-stmpe: Adjustments for two function implementations
Subsystems (3)
cover gpio-stmpe: Adjustments for two function implementations
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 20:58:42 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Use seq_putc() in stmpe_dbg_show()
Improve a size determination in stmpe_gpio_probe()
Move an assignment in stmpe_gpio_probe()
Delete an unnecessary variable initialisation in stmpe_gpio_probe()
drivers/gpio/gpio-stmpe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/4 gpio-stmpe: Use seq_putc() in stmpe_dbg_show()
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 19:30:50 +0100
A single character (line break) should be put into a sequence. Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
--- drivers/gpio/gpio-stmpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-stmpe.c +1 -1
@@ -350,7 +350,7 @@ static void stmpe_dbg_show(struct seq_file *s, struct gpio_chip *gc)for (i =0 ; i < gc->ngpio; i++, gpio++) {stmpe_dbg_show_one (s, gc, i, gpio); -seq_printf (s,"\n" ); +seq_putc (s,'\n' ); } }
Signature · 1 line
2.15.1
Re: [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show()
Quoted 9 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 19:30:50 +0100A single character (line break) should be put into a sequence. Thus use the corresponding function "
seq_putc".This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/4 gpio-stmpe: Improve a size determination in stmpe_gpio_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 19:36:29 +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-stmpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-stmpe.c +1 -1
@@ -437,7 +437,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) irq =platform_get_irq (pdev,0 ); - stmpe_gpio =kzalloc (sizeof (struct stmpe_gpio ),GFP_KERNEL ); + stmpe_gpio =kzalloc (sizeof (*stmpe_gpio),GFP_KERNEL );if (!stmpe_gpio)return -ENOMEM ;
Signature · 1 line
2.15.1
Re: [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe()
Quoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 19:36:29 +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
PATCH 3/4 gpio-stmpe: Move an assignment in stmpe_gpio_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 20:44:15 +0100
Move the assignment for the local variable "irq" so that its setting will only be performed directly before it is checked by this function.
--- drivers/gpio/gpio-stmpe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-stmpe.c +1 -2
@@ -435,8 +435,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)int ret;int irq =0 ; - irq =platform_get_irq (pdev,0 ); - stmpe_gpio =kzalloc (sizeof (*stmpe_gpio),GFP_KERNEL );if (!stmpe_gpio)return -ENOMEM ;
@@ -459,6 +457,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)if (stmpe_gpio->norequest_mask) stmpe_gpio->chip.irq.need_valid_mask = true; + irq =platform_get_irq (pdev,0 );if (irq <0 )dev_info (&pdev->dev, "device configured in no-irq mode: "
Signature · 1 line
2.15.1
Re: [PATCH 3/4] gpio-stmpe: Move an assignment in stmpe_gpio_probe()
Quoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 20:44:15 +0100Move the assignment for the local variable "irq" so that its setting will only be performed directly before it is checked by this function.
Signed-off-by Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 4/4 gpio-stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 20:48:40 +0100
The local variable "irq" will eventually be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/gpio/gpio-stmpe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-stmpe.c +1 -2
@@ -432,8 +432,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)struct stmpe *stmpe =dev_get_drvdata (pdev->dev.parent);struct device_node *np = pdev->dev.of_node;struct stmpe_gpio *stmpe_gpio; -int ret; -int irq =0 ; +int ret, irq; stmpe_gpio =kzalloc (sizeof (*stmpe_gpio),GFP_KERNEL );if (!stmpe_gpio)
Signature · 1 line
2.15.1
Re: [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe()
Quoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 Jan 2018 20:48:40 +0100The local variable "irq" will eventually be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
Signed-off-by Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij