Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1229926

Re: [PATCH] staging: dgap: fix returned errno code in dgap_parsefile()

From Javier Martinez Canillas <javier@osg.samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: dgap: fix returned errno code in dgap_parsefile()
Date 2015-09-22 08:40 +0200
Message-ID <qbpp7-5Qv-3@gated-at.bofh.it> (permalink)
References <qbjMK-64I-11@gated-at.bofh.it> <qbnQl-3r8-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello Sudip,

On 09/22/2015 06:52 AM, Sudip Mukherjee wrote:
> On Tue, Sep 22, 2015 at 02:39:36AM +0200, Javier Martinez Canillas wrote:
>> The driver is using -1 instead of the -ENOMEM defined macro to specify
>> that a buffer allocation failed. Since the error number is propagated,
>> the caller will get a -EPERM which is the wrong error condition.
> Just a little doubt. caller means the function which is calling this
> dgap_parsefile() or you meant the user?

I meant whatever function calls dgap_parsefile(), which currently is
only dgap_firmware_load().

> The function which is calling this dgap_parsefile() is just checking if
> it has received 0 or something else. Something else is error and it
> rerturns -EINVAL for all types of error (ofcourse that is also wrong).
> So the user will see -EINVAL for all types of error in dgap_parsefile().
>

Yes, I also verified what dgap_firmware_load() does with the returned error
code to make sure that it was safe to do this change without affecting the
rest of the driver.

But I believe the patch and what the commit message says is true regardless
of the fact that the caller is just checking for != 0. dgap_firmware_load()
stills gets a wrong error condition whether it's checking it or not.
 
> regards
> sudip
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: dgap: fix returned errno code in dgap_parsefile() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-09-22 02:40 +0200
  Re: [PATCH] staging: dgap: fix returned errno code in  dgap_parsefile() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-22 07:00 +0200
    Re: [PATCH] staging: dgap: fix returned errno code in  dgap_parsefile() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-09-22 08:40 +0200
      Re: [PATCH] staging: dgap: fix returned errno code in  dgap_parsefile() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-22 09:00 +0200

csiph-web