[PATCH 08/18] HID: Adjust five checks for null pointers
From: SF Markus Elfring
Date: Tue Feb 07 2017 - 14:50:53 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Feb 2017 19:15:21 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written !â
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/hid/hid-core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1f75c1c022f0..f4ea3590954c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -959,7 +959,7 @@ int hid_open_report(struct hid_device *device)
size = device->dev_rsize;
buf = kmemdup(start, size, GFP_KERNEL);
- if (buf == NULL)
+ if (!buf)
return -ENOMEM;
if (device->driver->report_fixup)
@@ -969,7 +969,7 @@ int hid_open_report(struct hid_device *device)
start = kmemdup(start, size, GFP_KERNEL);
kfree(buf);
- if (start == NULL)
+ if (!start)
return -ENOMEM;
device->rdesc = start;
@@ -1414,7 +1414,7 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
n = *data;
report = report_enum->report_id_hash[n];
- if (report == NULL)
+ if (!report)
dbg_hid("undefined report_id %u received\n", n);
return report;
@@ -2222,7 +2222,7 @@ static int hid_device_probe(struct device *dev)
if (!hdev->driver) {
id = hid_match_device(hdev, hdrv);
- if (id == NULL) {
+ if (!id) {
ret = -ENODEV;
goto unlock;
}
@@ -2719,7 +2719,7 @@ struct hid_device *hid_allocate_device(void)
int ret = -ENOMEM;
hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
- if (hdev == NULL)
+ if (!hdev)
return ERR_PTR(ret);
device_initialize(&hdev->dev);
--
2.11.1