linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Input: wm831x-on: Adjustments for wm831x_on_probe()
@ 2018-01-24 21:20 SF Markus Elfring
  2018-01-24 21:21 ` [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe() SF Markus Elfring
  2018-01-24 21:22 ` [PATCH 2/2] Input: wm831x-on: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: SF Markus Elfring @ 2018-01-24 21:20 UTC (permalink / raw)
  To: linux-input, patches, Dmitry Torokhov; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 22:15:43 +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/input/misc/wm831x-on.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

-- 
2.16.1

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

* [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe()
  2018-01-24 21:20 [PATCH 0/2] Input: wm831x-on: Adjustments for wm831x_on_probe() SF Markus Elfring
@ 2018-01-24 21:21 ` SF Markus Elfring
  2018-01-25  9:49   ` Charles Keepax
  2018-01-24 21:22 ` [PATCH 2/2] Input: wm831x-on: Improve a size determination " SF Markus Elfring
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2018-01-24 21:21 UTC (permalink / raw)
  To: linux-input, patches, Dmitry Torokhov; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:55:49 +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/input/misc/wm831x-on.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index 1b44de265a0a..06f5c4857a0c 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -77,10 +77,8 @@ static int wm831x_on_probe(struct platform_device *pdev)
 
 	wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on),
 				 GFP_KERNEL);
-	if (!wm831x_on) {
-		dev_err(&pdev->dev, "Can't allocate data\n");
+	if (!wm831x_on)
 		return -ENOMEM;
-	}
 
 	wm831x_on->wm831x = wm831x;
 	INIT_DELAYED_WORK(&wm831x_on->work, wm831x_poll_on);
-- 
2.16.1

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

* [PATCH 2/2] Input: wm831x-on: Improve a size determination in wm831x_on_probe()
  2018-01-24 21:20 [PATCH 0/2] Input: wm831x-on: Adjustments for wm831x_on_probe() SF Markus Elfring
  2018-01-24 21:21 ` [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe() SF Markus Elfring
@ 2018-01-24 21:22 ` SF Markus Elfring
  2018-01-25  9:49   ` Charles Keepax
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2018-01-24 21:22 UTC (permalink / raw)
  To: linux-input, patches, Dmitry Torokhov; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:58:42 +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/input/misc/wm831x-on.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index 06f5c4857a0c..0d8f7a11f63d 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -75,8 +75,7 @@ static int wm831x_on_probe(struct platform_device *pdev)
 	int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0));
 	int ret;
 
-	wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on),
-				 GFP_KERNEL);
+	wm831x_on = devm_kzalloc(&pdev->dev, sizeof(*wm831x_on), GFP_KERNEL);
 	if (!wm831x_on)
 		return -ENOMEM;
 
-- 
2.16.1

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

* Re: [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe()
  2018-01-24 21:21 ` [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe() SF Markus Elfring
@ 2018-01-25  9:49   ` Charles Keepax
  0 siblings, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2018-01-25  9:49 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-input, patches, Dmitry Torokhov, LKML, kernel-janitors

On Wed, Jan 24, 2018 at 10:21:39PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 24 Jan 2018 21:55:49 +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>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH 2/2] Input: wm831x-on: Improve a size determination in wm831x_on_probe()
  2018-01-24 21:22 ` [PATCH 2/2] Input: wm831x-on: Improve a size determination " SF Markus Elfring
@ 2018-01-25  9:49   ` Charles Keepax
  0 siblings, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2018-01-25  9:49 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-input, patches, Dmitry Torokhov, LKML, kernel-janitors

On Wed, Jan 24, 2018 at 10:22:35PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 24 Jan 2018 21:58:42 +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>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

end of thread, other threads:[~2018-01-25  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 21:20 [PATCH 0/2] Input: wm831x-on: Adjustments for wm831x_on_probe() SF Markus Elfring
2018-01-24 21:21 ` [PATCH 1/2] Input: wm831x-on: Delete an error message for a failed memory allocation in wm831x_on_probe() SF Markus Elfring
2018-01-25  9:49   ` Charles Keepax
2018-01-24 21:22 ` [PATCH 2/2] Input: wm831x-on: Improve a size determination " SF Markus Elfring
2018-01-25  9:49   ` Charles Keepax

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