Skip to contentSkip to conversation

net: phy: qcom: qca807x: normalize return value of gpio_get

PATCH Applied Dmitry Torokhov 4 participants 4 messages Feb 19 – Feb 21

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: phy: qcom: qca807x: normalize return value of gpio_get

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()")

---

v2: add correct netdev tree prefix and "fixes" tag.

 drivers/net/phy/qcom/qca807x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/qcom/qca807x.c +1 -1
index d8f1ce5a7128..6004da5741af 100644
@@ -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)
Signature · 5 lines
2.53.0.335.g19a08e0c02-goog


-- 
Dmitry
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 30 lines · Dmitry Torokhov

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()")

---

v2: add correct netdev tree prefix and "fixes" tag.

 drivers/net/phy/qcom/qca807x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/qcom/qca807x.c +1 -2
index d8f1ce5a7128..6004da5741af 100644
@@ -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

Quoted 3 lines

--
Dmitry

maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Dmitry Torokhov
Quoted 6 lines · Dmitry Torokhov

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()")

Yours,
Linus Walleij

#3 lore raw
In reply to Dmitry Torokhov
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · 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()")

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html