* [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get
@ 2026-02-19 0:56 Dmitry Torokhov
2026-02-19 9:18 ` Bartosz Golaszewski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2026-02-19 0:56 UTC (permalink / raw)
To: Andrew Lunn
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by qca807x_gpio_get() is
normalized to the [0, 1] range.
Fixes: 86ef402d805d ("gpiolib: sanitize the return value of gpio_chip::get()")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
v2: add correct netdev tree prefix and "fixes" tag.
drivers/net/phy/qcom/qca807x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c
index d8f1ce5a7128..6004da5741af 100644
--- a/drivers/net/phy/qcom/qca807x.c
+++ b/drivers/net/phy/qcom/qca807x.c
@@ -375,7 +375,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
- return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
+ return !!FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
}
static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
--
2.53.0.335.g19a08e0c02-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-19 0:56 [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
@ 2026-02-19 9:18 ` Bartosz Golaszewski
2026-02-19 18:25 ` Linus Walleij
2026-02-21 0:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-02-19 9:18 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio, Andrew Lunn
On Thu, 19 Feb 2026 01:56:00 +0100, Dmitry Torokhov
<dmitry.torokhov@gmail.com> said:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by qca807x_gpio_get() is
> normalized to the [0, 1] range.
>
> Fixes: 86ef402d805d ("gpiolib: sanitize the return value of gpio_chip::get()")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>
> v2: add correct netdev tree prefix and "fixes" tag.
>
> drivers/net/phy/qcom/qca807x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c
> index d8f1ce5a7128..6004da5741af 100644
> --- a/drivers/net/phy/qcom/qca807x.c
> +++ b/drivers/net/phy/qcom/qca807x.c
> @@ -375,7 +375,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
> reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
> val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
>
> - return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
> + return !!FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
> }
>
> static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
> --
> 2.53.0.335.g19a08e0c02-goog
>
>
> --
> Dmitry
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-19 0:56 [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 9:18 ` Bartosz Golaszewski
@ 2026-02-19 18:25 ` Linus Walleij
2026-02-21 0:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2026-02-19 18:25 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
On Thu, Feb 19, 2026 at 1:56 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by qca807x_gpio_get() is
> normalized to the [0, 1] range.
>
> Fixes: 86ef402d805d ("gpiolib: sanitize the return value of gpio_chip::get()")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-19 0:56 [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 9:18 ` Bartosz Golaszewski
2026-02-19 18:25 ` Linus Walleij
@ 2026-02-21 0:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-21 0:20 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, linusw, brgl,
netdev, linux-arm-msm, linux-kernel, linux-gpio
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Feb 2026 16:56:00 -0800 you wrote:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by qca807x_gpio_get() is
> normalized to the [0, 1] range.
>
> Fixes: 86ef402d805d ("gpiolib: sanitize the return value of gpio_chip::get()")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: phy: qcom: qca807x: normalize return value of gpio_get
https://git.kernel.org/netdev/net/c/2bb995e6155c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-21 0:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19 0:56 [PATCH net v2] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 9:18 ` Bartosz Golaszewski
2026-02-19 18:25 ` Linus Walleij
2026-02-21 0:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox