From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>,
linux-input@vger.kernel.org
Subject: Re: [PATCH] HID: usbkbd: return proper error code
Date: Wed, 31 Aug 2016 23:08:28 +0530 [thread overview]
Message-ID: <57C71614.6050807@gmail.com> (raw)
In-Reply-To: <CAOMZO5D7OW73GjqyAWD8Vap4cpY-VcvDwORJDqj8h3cq8Cg=rw@mail.gmail.com>
On Wednesday 31 August 2016 10:03 PM, Fabio Estevam wrote:
> On Wed, Aug 31, 2016 at 1:28 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.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@codethink.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
next prev parent reply other threads:[~2016-08-31 17:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 16:28 [PATCH] HID: usbkbd: return proper error code Sudip Mukherjee
2016-08-31 16:33 ` Fabio Estevam
2016-08-31 17:38 ` Sudip Mukherjee [this message]
2016-09-01 11:21 ` Jiri Kosina
2016-09-01 17:58 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57C71614.6050807@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=festevam@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).