提交 8522d62e 编写于 作者: J Jérôme Pouiller 提交者: Greg Kroah-Hartman

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201009171307.864608-7-Jerome.Pouiller@silabs.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 5f841fe6
...@@ -21,7 +21,7 @@ static void device_wakeup(struct wfx_dev *wdev) ...@@ -21,7 +21,7 @@ static void device_wakeup(struct wfx_dev *wdev)
if (!wdev->pdata.gpio_wakeup) if (!wdev->pdata.gpio_wakeup)
return; return;
if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup)) if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) >= 0)
return; return;
if (wfx_api_older_than(wdev, 1, 4)) { if (wfx_api_older_than(wdev, 1, 4)) {
......
...@@ -94,8 +94,8 @@ static int hif_startup_indication(struct wfx_dev *wdev, ...@@ -94,8 +94,8 @@ static int hif_startup_indication(struct wfx_dev *wdev,
static int hif_wakeup_indication(struct wfx_dev *wdev, static int hif_wakeup_indication(struct wfx_dev *wdev,
const struct hif_msg *hif, const void *buf) const struct hif_msg *hif, const void *buf)
{ {
if (!wdev->pdata.gpio_wakeup if (!wdev->pdata.gpio_wakeup ||
|| !gpiod_get_value(wdev->pdata.gpio_wakeup)) { gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) {
dev_warn(wdev->dev, "unexpected wake-up indication\n"); dev_warn(wdev->dev, "unexpected wake-up indication\n");
return -EIO; return -EIO;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册