* [PATCH 0/2] HID-Asus: Adjustments for two function implementations
@ 2018-02-06 17:28 SF Markus Elfring
2018-02-06 17:29 ` [PATCH 1/2] HID: asus: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-02-06 17:30 ` [PATCH 2/2] HID: asus: Return an error code only as a constant in asus_start_multitouch() SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-06 17:28 UTC (permalink / raw)
To: linux-input, Benjamin Tissoires, Jiri Kosina; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2018 18:24:56 +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 in two functions
Return an error code only as a constant in asus_start_multitouch()
drivers/hid/hid-asus.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] HID: asus: Delete an error message for a failed memory allocation in two functions
2018-02-06 17:28 [PATCH 0/2] HID-Asus: Adjustments for two function implementations SF Markus Elfring
@ 2018-02-06 17:29 ` SF Markus Elfring
2018-02-06 17:30 ` [PATCH 2/2] HID: asus: Return an error code only as a constant in asus_start_multitouch() SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-06 17:29 UTC (permalink / raw)
To: linux-input, Benjamin Tissoires, Jiri Kosina; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2018 18:03: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/hid/hid-asus.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 6d2894b7d8e7..9573e0b41922 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -566,7 +566,6 @@ static int asus_start_multitouch(struct hid_device *hdev)
if (!dmabuf) {
ret = -ENOMEM;
- hid_err(hdev, "Asus failed to alloc dma buf: %d\n", ret);
return ret;
}
@@ -599,10 +598,8 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct asus_drvdata *drvdata;
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
- if (drvdata == NULL) {
- hid_err(hdev, "Can't alloc Asus descriptor\n");
+ if (!drvdata)
return -ENOMEM;
- }
hid_set_drvdata(hdev, drvdata);
--
2.16.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] HID: asus: Return an error code only as a constant in asus_start_multitouch()
2018-02-06 17:28 [PATCH 0/2] HID-Asus: Adjustments for two function implementations SF Markus Elfring
2018-02-06 17:29 ` [PATCH 1/2] HID: asus: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2018-02-06 17:30 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-06 17:30 UTC (permalink / raw)
To: linux-input, Benjamin Tissoires, Jiri Kosina; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2018 18:18:50 +0100
Return an error code without storing it in an intermediate variable.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hid/hid-asus.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 9573e0b41922..5e143552dab9 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -564,10 +564,8 @@ static int asus_start_multitouch(struct hid_device *hdev)
const unsigned char buf[] = { FEATURE_REPORT_ID, 0x00, 0x03, 0x01, 0x00 };
unsigned char *dmabuf = kmemdup(buf, sizeof(buf), GFP_KERNEL);
- if (!dmabuf) {
- ret = -ENOMEM;
- return ret;
- }
+ if (!dmabuf)
+ return -ENOMEM;
ret = hid_hw_raw_request(hdev, dmabuf[0], dmabuf, sizeof(buf),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
--
2.16.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-06 17:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 17:28 [PATCH 0/2] HID-Asus: Adjustments for two function implementations SF Markus Elfring
2018-02-06 17:29 ` [PATCH 1/2] HID: asus: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-02-06 17:30 ` [PATCH 2/2] HID: asus: Return an error code only as a constant in asus_start_multitouch() 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).