public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-input@vger.kernel.org,
	"Arvind Yadav" <arvind.yadav.cs@gmail.com>,
	"Boris Brezillon" <boris.brezillon@free-electrons.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Günter Röck" <linux@roeck-us.net>,
	"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
	"Joseph Lo" <josephl@nvidia.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Stephen Lu" <lumotuwe@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] Input: gpio_keys: Delete an error message for a failed memory allocation in two functions
Date: Sat, 27 Jan 2018 13:55:00 +0000	[thread overview]
Message-ID: <6a34d439-6465-db9b-e8de-3f3b5b1ca257@users.sourceforge.net> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 14:42:19 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/input/keyboard/gpio_keys.c        | 4 +---
 drivers/input/keyboard/gpio_keys_polled.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 87e613dc33b8..d12fccf923d2 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -757,10 +757,8 @@ static int gpio_keys_probe(struct platform_device *pdev)
 	size = sizeof(struct gpio_keys_drvdata) +
 			pdata->nbuttons * sizeof(struct gpio_button_data);
 	ddata = devm_kzalloc(dev, size, GFP_KERNEL);
-	if (!ddata) {
-		dev_err(dev, "failed to allocate state\n");
+	if (!ddata)
 		return -ENOMEM;
-	}
 
 	ddata->keymap = devm_kcalloc(dev,
 				     pdata->nbuttons, sizeof(ddata->keymap[0]),
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index edc7262103b9..c79b1a75d036 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -253,10 +253,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 	size = sizeof(struct gpio_keys_polled_dev) +
 			pdata->nbuttons * sizeof(struct gpio_keys_button_data);
 	bdev = devm_kzalloc(dev, size, GFP_KERNEL);
-	if (!bdev) {
-		dev_err(dev, "no memory for private data\n");
+	if (!bdev)
 		return -ENOMEM;
-	}
 
 	poll_dev = devm_input_allocate_polled_device(dev);
 	if (!poll_dev) {
-- 
2.16.1


                 reply	other threads:[~2018-01-27 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a34d439-6465-db9b-e8de-3f3b5b1ca257@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=josephl@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lumotuwe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox