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(-)
--
2.15.1
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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/gpio/gpio-stmpe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index e3d048e65339..79858c6ad31a 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -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');
}
}
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/gpio/gpio-stmpe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 79858c6ad31a..2cf30dcba82a 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -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;
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/gpio/gpio-stmpe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 2cf30dcba82a..d51e27eb1c59 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -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: "
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/gpio/gpio-stmpe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index d51e27eb1c59..d9f370bf460d 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -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)
--
2.15.1
On Fri, Jan 12, 2018 at 9:01 PM, SF Markus Elfring
<[email protected]> wrote:
> 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Fri, Jan 12, 2018 at 9:02 PM, SF Markus Elfring
<[email protected]> wrote:
> From: 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Fri, Jan 12, 2018 at 9:03 PM, SF Markus Elfring
<[email protected]> wrote:
> From: 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Fri, Jan 12, 2018 at 9:04 PM, SF Markus Elfring
<[email protected]> wrote:
> From: 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij