Skip to contentSkip to conversation

HID: uclogic: remove redudant duplicated null check on ver_ptr

PATCH Applied Colin King 2 participants 2 messages Mar 2, 2019 – Mar 11, 2019

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 HID: uclogic: remove redudant duplicated null check on ver_ptr

From: Colin Ian King <[email protected]>

Currently ver_ptr is being null checked twice, once before calling usb_string and once afterwards. The second null check is redundant and can be removed, remove it.

Detected by CoverityScan, CID#1477308 ("Logically dead code")

---
 drivers/hid/hid-uclogic-params.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/hid/hid-uclogic-params.c +0 -4
index 7710d9f957da..0187c9f8fc22 100644
@@ -735,10 +735,6 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
 		goto cleanup;
 	}
 	rc = usb_string(udev, 201, ver_ptr, ver_len);
-	if (ver_ptr = NULL) {
-		rc = -ENOMEM;
-		goto cleanup;
-	}
 	if (rc = -EPIPE) {
 		*ver_ptr = '\0';
 	} else if (rc < 0) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Colin King

From: Colin Ian King <[email protected]>

Currently ver_ptr is being null checked twice, once before calling usb_string and once afterwards. The second null check is redundant and can be removed, remove it.

Detected by CoverityScan, CID#1477308 ("Logically dead code")

---

Applied to for-5.1/upstream-fixes

Cheers,
Benjamin

Quoted 21 lines
 drivers/hid/hid-uclogic-params.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/hid/hid-uclogic-params.c +0 -5
index 7710d9f957da..0187c9f8fc22 100644
@@ -735,10 +735,6 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
                goto cleanup;
        }
        rc = usb_string(udev, 201, ver_ptr, ver_len);
-       if (ver_ptr = NULL) {
-               rc = -ENOMEM;
-               goto cleanup;
-       }
        if (rc = -EPIPE) {
                *ver_ptr = '\0';
        } else if (rc < 0) {
--

2.20.1