RFC gpio: Handle NULL pointers gracefully
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest1 patch 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | gpio: Handle NULL pointers gracefullydrivers/ drivers/ include/ | +88 | 1 reply | |
| 1/1 | gpio: Handle NULL pointers gracefully | +0 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/1] gpio: Handle NULL pointers gracefully
Hi,
Patch [0] added devm_gpiod_get_index_optional() which would return NULL when when no GPIO was assigned to the requested function. This is convenient for drivers that need to handle optional GPIOs.
We need to take a stance on who is responsible for the NULL check: the driver or the GPIO core? Do we want to trust drivers to take care of the NULL checks, or do we want to distrust them and make sure they don't send us anything bogus in the GPIO core. Linux does not generally trust drivers and usually verifies anything it gets from them. And FWIW, I see that the clk and phy subsystems in U-Boot also perform checks like this.
The downside of the checks is of course that they increase code size. They might also slightly decrease performance. The benefit is that we don't burden drivers with taking care of this.
The patch itself is based on a similar patch by Jean-Jacques.
[0] https://patchwork.ozlabs.org/project/uboot/patch/20200529213808.2815-2-p.yadav at ti.com/
Pratyush Yadav (1):
gpio: Handle NULL pointers gracefully
drivers/gpio/Kconfig | 9 ++++ drivers/gpio/gpio-uclass.c | 86 ++++++++++++++++++++++++++++++++++---- include/asm-generic/gpio.h | 2 +- 3 files changed, 88 insertions(+), 9 deletions(-)
--
2.26.2