Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux