Re: [PATCH 13/54] gpio: pcf857x: Be sure to clamp return value

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

 



On Sun, Dec 27, 2015 at 8:47 AM, Laurent Pinchart
<laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:

> Would something like the following make sense ?
>
>         value = chip->get ? chip->get(chip, offset) : -EIO;
>         value = IS_ERR_VALUE(value) ? value : !!value;

Yeah that makes sense, I didn't think about using IS_ERR_VALUE()
to mitigate the situation.

Patches welcome :)

> Granted, GPIO drivers would still need to make sure that the value they return
> from register reads don't get considered as an error code, but any val & (1 <<
> offset) would be fine, which is the most common case.
>
> If you still think that patching all GPIO drivers is better I won't oppose to
> that.

I have already patches all the drivers with this problem, merged the
larger part of it and will merge the remainders for v4.6. The above is
still more elegant than the code we have so I'd take it to put some
nice robustness icing on top...

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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux