Skip to content

Commit

Permalink
staging: wfx: gpiod_get_value() can return an error
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201009171307.864608-7-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jérôme Pouiller authored and Greg Kroah-Hartman committed Oct 10, 2020
1 parent 5f841fe commit 8522d62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/wfx/bh.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void device_wakeup(struct wfx_dev *wdev)

if (!wdev->pdata.gpio_wakeup)
return;
if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup))
if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) >= 0)
return;

if (wfx_api_older_than(wdev, 1, 4)) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/wfx/hif_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ static int hif_startup_indication(struct wfx_dev *wdev,
static int hif_wakeup_indication(struct wfx_dev *wdev,
const struct hif_msg *hif, const void *buf)
{
if (!wdev->pdata.gpio_wakeup
|| !gpiod_get_value(wdev->pdata.gpio_wakeup)) {
if (!wdev->pdata.gpio_wakeup ||
gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) {
dev_warn(wdev->dev, "unexpected wake-up indication\n");
return -EIO;
}
Expand Down

0 comments on commit 8522d62

Please sign in to comment.