From patchwork Fri Oct 9 17:13:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 11826921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E57C433DF for ; Fri, 9 Oct 2020 17:13:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7421822258 for ; Fri, 9 Oct 2020 17:13:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="fp6G5Ozv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390202AbgJIRN4 (ORCPT ); Fri, 9 Oct 2020 13:13:56 -0400 Received: from mail-eopbgr760074.outbound.protection.outlook.com ([40.107.76.74]:48911 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732603AbgJIRNv (ORCPT ); Fri, 9 Oct 2020 13:13:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXmiV0YOeM1eeJWAEJ7fD+wGR/P6hGPmZf1g9XofBpd1Hd+OJcnOtkBeBNjsiopkd1Gk8ctg9CqnP/Nlz+GiSc2QIj/yEZ3zwyD405pRdjuRC4qdm4OXrtcFqOEeGw3Q7o3R783bD1dHW09LC4W5JPuJiC9RQyN4uHyUm9pOrm/cv9J02nwHQmIf9jpcvzXdnu/BY+SBigO0d9MY8HKYfRg6kFSkfG5I0JTcx2q0FNeJ0VVk9+FwLUGDmh0DW+AC8z/WTesyMDB9e1dwGoF20tqOqQO5kyuxpWoSCWK5eAttIZoDSATK6KMox5jTHm+py5t/y7T3H50eSQ2Cd5THgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QtasuF9Nudblhbs014fYVVwK2tUkPpLxKPDVvj58WjM=; b=D+EEzCnmoaRjoz3SrG5yxoFPxabH6V9mvbwF3HIrWDWuKXnmwApxPqPAFOp1H6tG+NBqixLkMv0y3NjCQgtyE4JzBeZO3M1HnCxfXCwiyAPsni3BI60BVrHH09qhuPIS0M2TZE8TIrYsQP9bHmGNFvIcRu5WG/jqxXmNv1P87QqMxR/JhYHA9LYMVGEojb5c0bKLuib4son0tMcfPyMmXrtSLn+ODHUz0n0ZrGBJp9zSj8PkrxyyeRtD0ZJ406c+JX6TdKUf9m11aibE+ZvVx2OuqXDYJcIpq1E1X+vHEp30llCy1E6i/pEkwaCuxZv1ngFfXejwfgA6OE8o1Px66g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QtasuF9Nudblhbs014fYVVwK2tUkPpLxKPDVvj58WjM=; b=fp6G5OzvCgpTir0ZHpjTgAZbvQtxw6i9DBrgXlND/78GRd5/oOKUQEPDfaukCAk1pxyFFz7lNIn1mO6N3IRAe5v0bxRgO9nOdkYi/iv8Upms+EInxwcH39niQpHcgqVgd7H2JjtjbAjOMsMB7KLzZfjg63kQgknm2i+4t7dQRlk= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none;driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB3455.namprd11.prod.outlook.com (2603:10b6:805:bb::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.22; Fri, 9 Oct 2020 17:13:34 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::4f5:fbe5:44a7:cb8a]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::4f5:fbe5:44a7:cb8a%5]) with mapi id 15.20.3455.024; Fri, 9 Oct 2020 17:13:33 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , Dan Carpenter , =?utf-8?b?SsOpcsO0bWUgUG91aWxs?= =?utf-8?b?ZXI=?= Subject: [PATCH 6/8] staging: wfx: gpiod_get_value() can return an error Date: Fri, 9 Oct 2020 19:13:05 +0200 Message-Id: <20201009171307.864608-7-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009171307.864608-1-Jerome.Pouiller@silabs.com> References: <20201009171307.864608-1-Jerome.Pouiller@silabs.com> X-Originating-IP: [82.67.86.106] X-ClientProxiedBy: SA9PR10CA0004.namprd10.prod.outlook.com (2603:10b6:806:a7::9) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (82.67.86.106) by SA9PR10CA0004.namprd10.prod.outlook.com (2603:10b6:806:a7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.24 via Frontend Transport; Fri, 9 Oct 2020 17:13:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b2fa867-46cd-471e-09eb-08d86c76a6ef X-MS-TrafficTypeDiagnostic: SN6PR11MB3455: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jo+Hu6pyok/TKJgjq/XfIVcGpFawVDxSbI9hwc3c84kGbw90wO4CoLC1XQ6NBjHv8GB8PtZv9Ip6DXh992FxZUf+zC2ymW1Z8s0lDviTMlZlZN5bK07OulACw4qTSDw/46827NLUhGV/i36OR727+3VXPVL73jTwOxb010vps2boX9lmzZ/ZgLypiinD7mhAjvwWw/hLzhLOf61l0xqD5avB0Zx76nMXrpd0Hhq0Fo9bWFHbhnD9D79Ts1FGUcCfwWFYIAHgBNlVZgpc3ZEs+CErjJkQh/PdMLRKFkG7E6X/AaoT6ZLIliG/Gt6O1FbTZ15gsTYZKM16kuAi2Of3Sg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2718.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(346002)(376002)(39850400004)(396003)(136003)(8936002)(36756003)(54906003)(1076003)(316002)(52116002)(7696005)(2906002)(5660300002)(478600001)(86362001)(4326008)(66946007)(66556008)(66476007)(6666004)(107886003)(26005)(16526019)(2616005)(83380400001)(186003)(8676002)(956004)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RQ5LmjiL6egQfY+7k8LxLdW9rBIHeMuPYifzjscuV6/SzmD11q/IK4PL1LhRhup5l/nXTbn1TojXKw+2GkVOdu4HTGdbrxFScBLysV67m8UrzM17T00SnmvCVAtHhKLE+7s5Euh7fgH7TNxCKnpg2cf93nZwg2lEkBp0i33ZMA/Ng64WB4W9s5KgF7ZtWI8J8b7rgCeugVOaqUsCF59GQxCWJzHsKdFskSLoeEPilJs0ZXSQUmUIjVYXfnuAHEdYhDxGg6/BOzztsDQWj6l/M98kwDg4cQ+xOvhxiMX6rf3dr6yY2lBrDy4KhCcFew3Yj6kIgJ6lVjdNkeZe2Ojf+bIfEGcUvUYumL+WX9LqpYG4kXHUhhNmkHp2iWk9Te9E61zaqjFL6UINq3KQeFTmQgW9OtwdzetHlcBLi9xChrC2eg3IxLoG3As1wthf0WdssI4A0vmfYOY/R4BwZh8Sv3AqtH5I5QzHhkSwrYP2ANG0S9eLhd8r+cKr284kzqg9chJPnYuqsoH0aHu5qYwtTDitAnR8U7tE7HYvYsjM2EjuRL53JSQke0OZu7od91fNf1lu2f2I9WtXK35Ztbt1i3QMcXQqjvon9g1dEzbUHfuX4vaPon/+FTuZ6QWY7au7YjyGCi1tR3zHZ+rFIIGhow== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b2fa867-46cd-471e-09eb-08d86c76a6ef X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2020 17:13:33.8317 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 03danYsUsPm+83G8UUavX00OUuzo6XmDzzzMLhEj4QDp0zTc3XYOs27tR3TxCtx3+krolJM6Lhld8P/bcJES5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3455 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller 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 Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 2 +- drivers/staging/wfx/hif_rx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 586b769c0446..2ffa587aefaa 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -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)) { diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 2d4265257112..f99921e76059 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -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; }