linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations
@ 2018-01-12 20:00 SF Markus Elfring
  2018-01-12 20:01 ` [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: SF Markus Elfring @ 2018-01-12 20:00 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show()
  2018-01-12 20:00 [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations SF Markus Elfring
@ 2018-01-12 20:01 ` SF Markus Elfring
  2018-01-16  9:59   ` Linus Walleij
  2018-01-12 20:02 ` [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe() SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2018-01-12 20:01 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe()
  2018-01-12 20:00 [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations SF Markus Elfring
  2018-01-12 20:01 ` [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show() SF Markus Elfring
@ 2018-01-12 20:02 ` SF Markus Elfring
  2018-01-16 10:00   ` Linus Walleij
  2018-01-12 20:03 ` [PATCH 3/4] gpio-stmpe: Move an assignment " SF Markus Elfring
  2018-01-12 20:04 ` [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation " SF Markus Elfring
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2018-01-12 20:02 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] gpio-stmpe: Move an assignment in stmpe_gpio_probe()
  2018-01-12 20:00 [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations SF Markus Elfring
  2018-01-12 20:01 ` [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show() SF Markus Elfring
  2018-01-12 20:02 ` [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe() SF Markus Elfring
@ 2018-01-12 20:03 ` SF Markus Elfring
  2018-01-16 10:03   ` Linus Walleij
  2018-01-12 20:04 ` [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation " SF Markus Elfring
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2018-01-12 20:03 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe()
  2018-01-12 20:00 [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2018-01-12 20:03 ` [PATCH 3/4] gpio-stmpe: Move an assignment " SF Markus Elfring
@ 2018-01-12 20:04 ` SF Markus Elfring
  2018-01-16 10:04   ` Linus Walleij
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2018-01-12 20:04 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show()
  2018-01-12 20:01 ` [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show() SF Markus Elfring
@ 2018-01-16  9:59   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2018-01-16  9:59 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-gpio, LKML, kernel-janitors

On Fri, Jan 12, 2018 at 9:01 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe()
  2018-01-12 20:02 ` [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe() SF Markus Elfring
@ 2018-01-16 10:00   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2018-01-16 10:00 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-gpio, LKML, kernel-janitors

On Fri, Jan 12, 2018 at 9:02 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] gpio-stmpe: Move an assignment in stmpe_gpio_probe()
  2018-01-12 20:03 ` [PATCH 3/4] gpio-stmpe: Move an assignment " SF Markus Elfring
@ 2018-01-16 10:03   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2018-01-16 10:03 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-gpio, LKML, kernel-janitors

On Fri, Jan 12, 2018 at 9:03 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe()
  2018-01-12 20:04 ` [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation " SF Markus Elfring
@ 2018-01-16 10:04   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2018-01-16 10:04 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-gpio, LKML, kernel-janitors

On Fri, Jan 12, 2018 at 9:04 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-16 10:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12 20:00 [PATCH 0/4] gpio-stmpe: Adjustments for two function implementations SF Markus Elfring
2018-01-12 20:01 ` [PATCH 1/4] gpio-stmpe: Use seq_putc() in stmpe_dbg_show() SF Markus Elfring
2018-01-16  9:59   ` Linus Walleij
2018-01-12 20:02 ` [PATCH 2/4] gpio-stmpe: Improve a size determination in stmpe_gpio_probe() SF Markus Elfring
2018-01-16 10:00   ` Linus Walleij
2018-01-12 20:03 ` [PATCH 3/4] gpio-stmpe: Move an assignment " SF Markus Elfring
2018-01-16 10:03   ` Linus Walleij
2018-01-12 20:04 ` [PATCH 4/4] gpio-stmpe: Delete an unnecessary variable initialisation " SF Markus Elfring
2018-01-16 10:04   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).