From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-input@vger.kernel.org,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Jiri Kosina <jikos@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/6] hid-prodikeys: Delete two error messages for a failed memory allocation in pk_probe()
Date: Sat, 3 Feb 2018 18:37:50 +0100 [thread overview]
Message-ID: <b0d723a5-73f9-e937-b93b-79174d4d0ede@users.sourceforge.net> (raw)
In-Reply-To: <c388b4d8-fa43-1bf2-e27d-1a3a8d636118@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 3 Feb 2018 14:36:20 +0100
Omit extra messages 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/hid/hid-prodikeys.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 87eda34ea2f8..9cad4973a67b 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -802,15 +802,12 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
pk = kzalloc(sizeof(*pk), GFP_KERNEL);
- if (pk == NULL) {
- hid_err(hdev, "can't alloc descriptor\n");
+ if (!pk)
return -ENOMEM;
- }
pk->hdev = hdev;
pm = kzalloc(sizeof(*pm), GFP_KERNEL);
if (pm == NULL) {
- hid_err(hdev, "can't alloc descriptor\n");
ret = -ENOMEM;
goto err_free_pk;
}
--
2.16.1
next prev parent reply other threads:[~2018-02-03 17:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-03 17:36 [PATCH 0/6] HID-Prodikeys: Adjustments for two function implementations SF Markus Elfring
2018-02-03 17:37 ` SF Markus Elfring [this message]
2018-02-03 17:38 ` [PATCH 2/6] hid-prodikeys: Delete an unnecessary variable initialisation in pk_probe() SF Markus Elfring
2018-02-03 17:39 ` [PATCH 3/6] hid-prodikeys: Move an assignment " SF Markus Elfring
2018-02-03 17:40 ` [PATCH 4/6] hid-prodikeys: Delete an unnecessary return statement in pcmidi_send_note() SF Markus Elfring
2018-02-03 17:41 ` [PATCH 5/6] hid-prodikeys: Combine two condition checks into one " SF Markus Elfring
2018-02-03 17:42 ` [PATCH 6/6] hid-prodikeys: Rename a jump label " SF Markus Elfring
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=b0d723a5-73f9-e937-b93b-79174d4d0ede@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).