[PATCH] HID: usbhid: Fix use assignment in if condition

From: wuyonggang001
Date: Mon Jul 10 2023 - 21:47:13 EST


Fix the following checkpatch error(s):

drivers/hid/usbhid/usbkbd.c:238:240:242:246: ERROR: do not use assignment in if condition

Signed-off-by: Yonggang Wu <wuyonggang001@xxxxxxxxxx>
---
drivers/hid/usbhid/usbkbd.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index c439ed2f16db..cde7f82b7070 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -235,15 +235,29 @@ static void usb_kbd_close(struct input_dev *dev)

static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
{
- if (!(kbd->irq = usb_alloc_urb(0, GFP_KERNEL)))
+ kbd->irq = usb_alloc_urb(0, GFP_KERNEL)
+
+ if (!kbd->irq)
return -1;
- if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL)))
+
+ kbd->led = usb_alloc_urb(0, GFP_KERNEL)
+
+ if (!kbd->led)
return -1;
- if (!(kbd->new = usb_alloc_coherent(dev, 8, GFP_KERNEL, &kbd->new_dma)))
+
+ kbd->new = usb_alloc_coherent(dev, 8, GFP_KERNEL, &kbd->new_dma)
+
+ if (!kbd->new)
return -1;
- if (!(kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL)))
+
+ kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL)
+
+ if (!kbd->cr)
return -1;
- if (!(kbd->leds = usb_alloc_coherent(dev, 1, GFP_KERNEL, &kbd->leds_dma)))
+
+ kbd->leds = usb_alloc_coherent(dev, 1, GFP_KERNEL, &kbd->leds_dma)
+
+ if (!kbd->leds)
return -1;

return 0;