Skip to content

Commit 8522d62

Browse files
jerome-pouillergregkh
authored andcommitted
staging: wfx: gpiod_get_value() can return an error
Smatch complains: hif_rx.c:98 hif_wakeup_indication() warn: 'gpiod_get_value(wdev->pdata.gpio_wakeup)' returns positive and negative bh.c:24 device_wakeup() warn: 'gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup)' returns positive and negative Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Jérôme Pouiller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5f841fe commit 8522d62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/staging/wfx/bh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void device_wakeup(struct wfx_dev *wdev)
2121

2222
if (!wdev->pdata.gpio_wakeup)
2323
return;
24-
if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup))
24+
if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) >= 0)
2525
return;
2626

2727
if (wfx_api_older_than(wdev, 1, 4)) {

drivers/staging/wfx/hif_rx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ static int hif_startup_indication(struct wfx_dev *wdev,
9494
static int hif_wakeup_indication(struct wfx_dev *wdev,
9595
const struct hif_msg *hif, const void *buf)
9696
{
97-
if (!wdev->pdata.gpio_wakeup
98-
|| !gpiod_get_value(wdev->pdata.gpio_wakeup)) {
97+
if (!wdev->pdata.gpio_wakeup ||
98+
gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) {
9999
dev_warn(wdev->dev, "unexpected wake-up indication\n");
100100
return -EIO;
101101
}

0 commit comments

Comments
 (0)