linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] GPIO-Timberdale: Adjustments for timbgpio_probe()
@ 2018-02-10 20:31 SF Markus Elfring
  2018-02-10 20:32 ` [PATCH 1/2] gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe() SF Markus Elfring
  2018-02-10 20:33 ` [PATCH 2/2] gpio: timberdale: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-10 20:31 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

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

-- 
2.16.1


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

* [PATCH 1/2] gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe()
  2018-02-10 20:31 [PATCH 0/2] GPIO-Timberdale: Adjustments for timbgpio_probe() SF Markus Elfring
@ 2018-02-10 20:32 ` SF Markus Elfring
  2018-02-10 20:33 ` [PATCH 2/2] gpio: timberdale: Improve a size determination " SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-10 20:32 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpio/gpio-timberdale.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index 181f86ce00cd..ff155e437210 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -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);
-- 
2.16.1

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

* [PATCH 2/2] gpio: timberdale: Improve a size determination in timbgpio_probe()
  2018-02-10 20:31 [PATCH 0/2] GPIO-Timberdale: Adjustments for timbgpio_probe() SF Markus Elfring
  2018-02-10 20:32 ` [PATCH 1/2] gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe() SF Markus Elfring
@ 2018-02-10 20:33 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-10 20:33 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij; +Cc: LKML, kernel-janitors

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpio/gpio-timberdale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index ff155e437210..6520a8475910 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -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;
 
-- 
2.16.1


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

end of thread, other threads:[~2018-02-10 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-10 20:31 [PATCH 0/2] GPIO-Timberdale: Adjustments for timbgpio_probe() SF Markus Elfring
2018-02-10 20:32 ` [PATCH 1/2] gpio: timberdale: Delete an error message for a failed memory allocation in timbgpio_probe() SF Markus Elfring
2018-02-10 20:33 ` [PATCH 2/2] gpio: timberdale: Improve a size determination " SF Markus Elfring

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).