All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis de Bethencourt <luisbg@osg.samsung.com>
To: Jiri Kosina <jikos@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()
Date: Tue, 06 Oct 2015 09:58:54 +0100	[thread overview]
Message-ID: <56138D4E.1070008@osg.samsung.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1510051616280.2758@pobox.suse.cz>

On 05/10/15 15:24, Jiri Kosina wrote:
> On Sat, 3 Oct 2015, Luis de Bethencourt wrote:
> 
>>> But I am not really sure where you are seeing the bug (mapping to 
>>> -EPERM) in this case? I think the only caller of hiddev_connect() 
>>> should be hid_connect(), and the only thing that guy cares about 
>>> whether individual callbacks succeed or fail, so that it sets 
>>> hdev->clamed flags accordingly.
>>>
>>> Could you please be more specific about the -EPERM mapping you are 
>>> talking about?
>>>
>> I agree with you. The only caller of hiddev_connect() only checks if the
>> callback succeded. It checks if the return < 0.
>> What I meant is that -1 means -EPERM. [0]
> 
> I still don't understand what problem you are chasing here, sorry. EPERM 
> is defined to be 1, yes. So are many other completely unrelated #defines.
> 
>> This patch is purely about the correctness of using -ENOMEM. The word 
>> "propagated" was not the best way to describe this problem. I could edit 
>> the commit message if you would like.
> 
> You seem to imply that someone might be interpreting that -1 as a define 
> from errno.h. But that's not the case.
> 
> Are you going to look at every 'return -1' occurence in the kernel and 
> convert it to something else? That can keep you busy for quite some time:
> 
> 	$ git grep 'return -1' | wc -l
> 	9167
> 
> The only cleanup I'd imagine at least remotely possible in this case would 
> be to convert the ->connect() callbacks return bool.
> 

This is a very good point. I will write a second version of the patch that
converts the return to a boolean.

Thanks for the review,
Luis

      reply	other threads:[~2015-10-06  8:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30  9:52 [PATCH] HID: hiddev: fix returned errno code in hiddev_connect() Luis de Bethencourt
2015-09-30  9:56 ` Luis de Bethencourt
2015-09-30 10:04   ` Sudip Mukherjee
2015-09-30 10:05     ` Luis de Bethencourt
2015-09-30 10:05       ` Luis de Bethencourt
2015-09-30 19:40 ` Jiri Kosina
2015-10-03 21:34   ` Luis de Bethencourt
2015-10-05 14:24     ` Jiri Kosina
2015-10-06  8:58       ` Luis de Bethencourt [this message]

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=56138D4E.1070008@osg.samsung.com \
    --to=luisbg@osg.samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.