[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57C71614.6050807@gmail.com>
Date: Wed, 31 Aug 2016 23:08:28 +0530
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Fabio Estevam <festevam@...il.com>
CC: Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>,
linux-input@...r.kernel.org
Subject: Re: [PATCH] HID: usbkbd: return proper error code
On Wednesday 31 August 2016 10:03 PM, Fabio Estevam wrote:
> On Wed, Aug 31, 2016 at 1:28 PM, Sudip Mukherjee
> <sudipm.mukherjee@...il.com> wrote:
>> Use proper error code instead of using -1 on failure to allocate
>> memory. We may use the error code later in the caller.
>>
>> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
>> ---
>> drivers/hid/usbhid/usbkbd.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
>> index 9a332e6..ee53359 100644
>> --- a/drivers/hid/usbhid/usbkbd.c
>> +++ b/drivers/hid/usbhid/usbkbd.c
>> @@ -249,15 +249,15 @@ 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)))
>> - return -1;
>> + return -ENOMEM;
>
> While you are it, the code would look better like this:
>
> kbd->irq = usb_alloc_urb(0, GFP_KERNEL)
> if (!kbd->irq)
> return -ENOMEM;
>
Yes, it will. But that will become two changes in one patch. I will send
a series with this sent patch and another patch to reorder the assignment.
regards
sudip
Powered by blists - more mailing lists