Skip to content
/ linux Public

Commit cb8f0a3

Browse files
dtorSasha Levin
authored andcommitted
net: phy: qcom: qca807x: normalize return value of gpio_get
[ Upstream commit 2bb995e ] 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: 86ef402 ("gpiolib: sanitize the return value of gpio_chip::get()") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/aZZeyr2ysqqk2GqA@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9605406 commit cb8f0a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/phy/qcom/qca807x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
375375
reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
376376
val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
377377

378-
return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
378+
return !!FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
379379
}
380380

381381
static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)

0 commit comments

Comments
 (0)