Re: [PATCH 1/4] regmap: sdw: move to -EOPNOTSUPP

From: Takashi Iwai
Date: Wed Aug 26 2020 - 06:22:32 EST


On Wed, 26 Aug 2020 12:13:01 +0200,
Mark Brown wrote:
>
> On Wed, Aug 26, 2020 at 12:09:28PM +0200, Takashi Iwai wrote:
> > Mark Brown wrote:
>
> > > checkpatch is broken.
>
> > Heh, I'm not objecting it :)
>
> > OTOH, it's also true that ENOTSUPP is no good error code if returned
> > to user-space. Unfortunately many codes (including what I wrote) use
> > this code mistakenly, and they can't be changed any longer...
>
> It's also used internally in various places without being returned to
> userspace, that's what's going on here - the regmap core has some
> specific checks for -ENOTSUPP.

Sure, for such an internal usage any code can be used.
The question is a case like this -- where the return code might be
carried to outside. Though, looking through the grep output, all
callers simply return -EINVAL for any errors, so it doesn't matter
much for now.


BTW, there are a few callers of devm_regmap_init_sdw() checking the
return value with NULL. This will crash as the function returns the
error pointer, and they must be checked with IS_ERR() instead.


Takashi