Commit 30e0fd3
gpiolib: fix performance regression when using gpio_chip_get_multiple()
commit 74abd08 ("gpiolib: sanitize the return value of
gpio_chip::get_multiple()") altered the value returned by
gc->get_multiple() in case it is positive (> 0), but failed to return
for other cases (<= 0).
This may result in the "if (gc->get)" block being executed and thus
negates the performance gain that is normally obtained by using
gc->get_multiple().
Fix by returning the result of gc->get_multiple() if it is <= 0.
Also move the "ret" variable to the scope where it is used, which as an
added bonus fixes an indentation error introduced by the aforementioned
commit.
Fixes: 74abd08 ("gpiolib: sanitize the return value of gpio_chip::get_multiple()")
Cc: stable@vger.kernel.org
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20250703191829.2952986-1-hugo@hugovil.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>1 parent d0b3b7b commit 30e0fd3
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3297 | 3297 | | |
3298 | 3298 | | |
3299 | 3299 | | |
3300 | | - | |
3301 | | - | |
3302 | 3300 | | |
3303 | 3301 | | |
3304 | 3302 | | |
| 3303 | + | |
| 3304 | + | |
3305 | 3305 | | |
3306 | 3306 | | |
3307 | 3307 | | |
| 3308 | + | |
3308 | 3309 | | |
3309 | 3310 | | |
3310 | 3311 | | |
| |||
0 commit comments