From patchwork Fri Oct 9 17:13:01 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: 287853 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=-9.9 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, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 CA54AC43467 for ; Fri, 9 Oct 2020 17:13:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 961CC22265 for ; Fri, 9 Oct 2020 17:13:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Js5QUvGR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390076AbgJIRNb (ORCPT ); Fri, 9 Oct 2020 13:13:31 -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 S2390039AbgJIRNa (ORCPT ); Fri, 9 Oct 2020 13:13:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=odGaW+QT6zwBWxqKeeR+L0XRoIPplHJZ8AnBJh2k+k7nRnc4wCtKBcvjuzYHnNYron7OFN9k4OIYFF1p+3pJgOApWQBUBD/edHceMYzjv0iDVVjscWIV5uzPrsM1cC9/QLj+7Iti0ZLE/Kjc5WyzjC2mvXJboXQC1nb8ZLJvqEqMD71MTsz51kn2x8ytRDpzvz7oar6iipR/iY0VhZuHnP8rSriaQ6tPbedkGp3W+QPjVvVSfdfnLQu6uTWNHHLVCJxKifXCOC9KkOLZ3v5kyIjJDIUmKyM/hHUxh8oADk0Gb5BePIreLCJM0QSEWOu5TE9wCcqpZnSdG8pQ9q+oOQ== 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=rYYlhGzwZ5nf29iOCV3SfxyoDp2SA8k80kV08YVuKrg=; b=Z8VOqvqA1kotxXDoQ1yqVwTVyFyq2qPKQf2SyZ7OdrD/tOE+qOVY82keb0CEPAACQ2SxYr3r7xcXm6L87Y/52D8CMUyJuhh932mUhoufWq7LOtmao6fIsoS8+DSPYq8Vz0YQE9gadKuUHrwR1YN+XkNaNu/kCuE6er1KNrguVhZA7cpSOk+H2g/l+ETB8ogEZ7qOOEOhDskJ33hEpf9y7S7rmnbLsWHzZFLoOlesmjEco3PMR7Y32xjvWb0FXppwOkhQUdvszpyflxaGy/v2qojGN3dzAbrv8tnfrpDtSmqLnkmdev3gMGwDeXqhhzG2F/Umi7rue9PVPTmhybtCBw== 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=rYYlhGzwZ5nf29iOCV3SfxyoDp2SA8k80kV08YVuKrg=; b=Js5QUvGRevkOaHU3I9yTh/f14zgTKbLOuHh08hMiWJn7SgFgQWQhtU0HL6ZODFWCiJoy20jFYeNe+RuL4oRTG5PIVXfHrkcn+FU7/XQfGQFnWBgxfNpJNavWCWwQLOa6fHQJCFjK4W4NI/hKFpiR1bVa5p97Cc6EYGbixLNsMbg= 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:26 +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:26 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH 2/8] staging: wfx: check memory allocation Date: Fri, 9 Oct 2020 19:13:01 +0200 Message-Id: <20201009171307.864608-3-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:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72d09282-b570-4298-47c5-08d86c76a245 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: 14VxSr0rjZ2E8+s8lnzdK5juHgDCGM8C1GAKXZnEH0GFQDqqs/icuvNBRQ+L7H99ka1LwV4vzZiHhnysJ9ak7cJoh2WXrlgEAUCUnh94bIMt9mY7yPgMcOqgOwHx+Jbi8/UsLxttICOSRGQv5dNsPsY8rd/SuBXXZ36zEFVPlMbxVYR+usRj+3oSWUN9rqpCLXPA2A6Xk+bYAll7WOcits8ElkCLNnc1W1jkKq+J5RjXx5YCzEsizOlSW2BXXV2Vmhgi0K/MmBvJqqEFnLNaq4js9aBAtltHsLNQD3JZZFdLCTkIhWvl/5QZDfnLiFyeI+mbVHtJ7/TV7bt+8COnlg== 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)(66574015)(86362001)(4326008)(66946007)(66556008)(66476007)(6666004)(107886003)(26005)(16526019)(2616005)(83380400001)(186003)(8676002)(956004)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +kxWThVpH30h8AwPYpLjkpsVZ4XOBrO+H8rHYs/kVddlFzOPlO85K4dvby7ZVuPCPDWMS9dpLQvCRWqfDC2lztKSOTSVs3fQLXwElC+Agf3QGN4GjGr+eW1oqeaDVIzxKIF5XrFpCzu8Lr+kgXHU/5aqljrLWeCTFgv5nFkhIGy+ow4nWDunE+14/VKc4fouPZxs4LncBIb4AwCSbbqk/bwAwiQt9zJ8UhcriNFa5tT4SBhbI/2nvmmRTOPO25gEOjaRDzSDcQ9/yp7gws5XYCzyctHJtZ4S7tlxfCiOssZcjLHF//qfHw4U5nEbA1pVczPZ7Kmyqqc7qEXpBvyBuv7QHtCuaaKNJGoXQ6TctWH4ugiGf6PwzmF8BrRHoB3OcFIZCO7jPEhEFVayt9YTe9iFknOH1j/3zG4CnC1ONlDHO15JXR7hFkyqHt/WUqMHyatASRDRB8QsJ4TMH614veo2OZqCHyVNQTruYwuSRm40Xtv3Cy43In1oD7u4C3pd3Ic/BS30QedKIsg08FqYhtzrSlqiDruqCj90C8/n+l1zDU+7b3RTOFrKLAB4dnf9hj3k3eB5lN0/tZEIfTwmifkxgVheKYTTsFPdkJeypQaYj/BPBS4rdwFFlexIh2wjiMn+ZwrDv3Yk45D+86u8dA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72d09282-b570-4298-47c5-08d86c76a245 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:26.0103 (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: yAUMWqFeDRFcvGVhuflY+30d9uS0Ko40y4ofQMmKnp4tGqEQXXPY9uhD6rcQkKWxkeYMGmAyMeP2w0N/o1nE/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3455 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Smatch complains: main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter dereference 'tmp_buf' 227 tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); 228 ret = wfx_send_pds(wdev, tmp_buf, pds->size); ^^^^^^^ 229 kfree(tmp_buf); Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index df11c091e094..a8dc2c033410 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -222,12 +222,18 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev) if (ret) { dev_err(wdev->dev, "can't load PDS file %s\n", wdev->pdata.file_pds); - return ret; + goto err1; } tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); + if (!tmp_buf) { + ret = -ENOMEM; + goto err2; + } ret = wfx_send_pds(wdev, tmp_buf, pds->size); kfree(tmp_buf); +err2: release_firmware(pds); +err1: return ret; } From patchwork Fri Oct 9 17:13:02 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: 287849 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 B74C3C433DF for ; Fri, 9 Oct 2020 17:14:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77BA722258 for ; Fri, 9 Oct 2020 17:14:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="UlzW7vll" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390105AbgJIRNl (ORCPT ); Fri, 9 Oct 2020 13:13:41 -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 S1732488AbgJIRNd (ORCPT ); Fri, 9 Oct 2020 13:13:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ipMie+1kAjsJKmk5z5eQ8/ZI1BbbSTuYHGyTmB43gh1quCD8nT2icBpX5RYzH/k85abx/zOd9MicKwHYZWC8FK/Lgeb01I0Oxxo94zOkO0Bg6QmqDyep38O0IQntUg7LbMQf2ToRl7lIdaqal2L9E4naUUOiXIWDDDakznQVZj7FNsQDT+79Bm2/xWAACI2OX+cX5MhlHL5gR3zHE5l+K/Ggf82vKCVKSaJojfLmeAbnlbNPomw8ZxVgwnQeLQqEegS6ZSVMPgiHA01jOaXptu/6w4hnV4kZDr5jk53pkpQoSyAweg0RohLxGx/icKt7MjYIUqXdoBt+LgS9I0zXdg== 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=uQt70Y/LPjZH5xiGV8CtR5xvL0XVIYWyKXWcFkSGMBg=; b=JpkW5B+AqtSEN2IP+yJ2BoEQLFKy4aJBMKD3Teq69p6rNUn7eteq9RCpv7wra8xSpnw2PxbIN+byDkAwZu8xr5TmTorDj+p+6mY3lPC8efQUkE+dOpCwXqX2kT7bxREnwuiJuRQDDc15zo+lhkWgAkWvoIzZrVzn8ScWOvZCIwfWQK2xzOqYZhq1wfdEQqitZGg9bWxMYonrY6K50Apuiz4E+3OGd1pgloKHzeWWHP8URELyhCirpEcEgOr38yU7Puh3V4DLizdpdhXHEma3MbTEPLJwyuwf1XfLxzD4+PyFxUgqwsHpGO1f+purnEhluk6QUdnlxUK/Bz/OMrUrRg== 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=uQt70Y/LPjZH5xiGV8CtR5xvL0XVIYWyKXWcFkSGMBg=; b=UlzW7vllx1MVMpA5P7GStxkGQwhAlzzojkPcO02EynKDd/tL5iHtxmakze3OLE+1dr5FuNR08sgETaIuwRiXhPOnMd8eoG3X1rnsCxIkH6I1kIYQGQgrrqsqojndWYWOkuJTPCIk9O5Ij+LUV87OTWAmhS2p68Pl6FW/gB1ROXo= 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:28 +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:27 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH 3/8] staging: wfx: standardize the error when vif does not exist Date: Fri, 9 Oct 2020 19:13:02 +0200 Message-Id: <20201009171307.864608-4-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:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50745ac1-2daa-4cf9-3c3a-08d86c76a358 X-MS-TrafficTypeDiagnostic: SN6PR11MB3455: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0cTaCDFgiJbIJShhdTmWv44GEgOOebkTn/YiaukrcJ//KjPMErfv8fVtbfYf+iBut2OPkCzmuwTgpZLO42cqj2Tk50z9qUHdwstnOO2TtiRpPBoB1c5H8YDjVvYr17F6yeOXWjWmx4jA+ZkMhY0+pIvkScmGmF2kM+fCqx6KUpX34qX3fc/MlU4mgXlzdgZDK3I+OtQ1kekzGPqmBg+V1JsD+GYWr+wf94fhcHKsjjDM/UjyGMhAOAXwyq18QUEeyrFblHzfspkaS6eIFXPAkOqpfau0MsifBFjvDMxlJucKjXhntWw7/pMApXlYx9YMeqYbCkro8owbehHQG9EnqA== 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)(66574015)(86362001)(4326008)(66946007)(66556008)(66476007)(6666004)(107886003)(26005)(16526019)(2616005)(83380400001)(186003)(8676002)(956004)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +B5GaRfJ1OTE66YUAoc5mtllAer2DWFfJOdbnwR54vQKS9WdzcYc3Jlprj9mxZz0uQnujtNWDuIAjii+fYke/fjh2ghXkWTSvXtK4cwlLAXEH7EJegKruVorupVxlCHIQSOO+qIPy/7b8/tSSLT5kgDDAtWxl2+AnUkuIOERJISY3qryjwbU9zRWSN5x+8aMxT4o1FH0JimhW0Ihv3zYbdSJLdzQ7YN8jg6yGjLBgIgEcB8/LO8Qq0Natjsyts5kVVxEMt7B2WTmKsGDa5OTOZoUvmH52VGO4fljQAoVMq6spL45RRNi8hzVwsm4j80i1IBAnmVoUqVdSJlBeUjJlLLivTDTF8ABkcmNqi+8Hue9NWfGfDMzAkn1wRexZAiiXlMzkjF8u/78eJgxZWutm7jMPwZSKoQ+Qr1A6yYvVqc1x7qCeosCvi2jx4E0fT/Bzav3OJ1bvL5g5Tj08hwKccXsVKdfOfteMv1rm5ibyZ2BKd9lG6GU1NKCOoydw13xv7adgFf7w/Iq/ezwWrMvycV/NoXv16v3pKzsiGfXAvsHhdeloM9TP1NXBUs3WCM2FFzy+7RhoYy74ZvjhfgPXS/oMJ+k3MhCl2dhH+Bq8DsDf3UvvAWMS87C5sn1Ec/IkAJrTX7yzW620zbaLsLEgA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50745ac1-2daa-4cf9-3c3a-08d86c76a358 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:27.8153 (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: Hd3YAZXdDBfJwd6CJ75t+2yOv9DP6BgJ3EFNwd2QB324uE3tpGftLT01yrYe6cVFgsNPshMvKX6xbTxy+LlIRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3455 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Smatch complains: drivers/staging/wfx/hif_rx.c:177 hif_scan_complete_indication() warn: potential NULL parameter dereference 'wvif' drivers/staging/wfx/data_tx.c:576 wfx_flush() warn: potential NULL parameter dereference 'wvif' Indeed, if the vif id returned by the device does not exist anymore, wdev_to_wvif() could return NULL. In add, the error is not handled uniformly in the code, sometime a WARN() is displayed but code continue, sometime a dev_warn() is displayed, sometime it is just not tested, ... This patch standardize that. Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 5 ++++- drivers/staging/wfx/hif_rx.c | 34 ++++++++++++++++++++++++---------- drivers/staging/wfx/sta.c | 4 ++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index b4d5dd3d2d23..8db0be08daf8 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -431,7 +431,10 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) sizeof(struct hif_req_tx) + req->fc_offset; - WARN_ON(!wvif); + if (!wvif) { + pr_warn("%s: vif associated with the skb does not exist anymore\n", __func__); + return; + } wfx_tx_policy_put(wvif, req->retry_policy_index); skb_pull(skb, offset); ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index d6dfab094b03..ca09467cba05 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -110,9 +110,9 @@ static int hif_receive_indication(struct wfx_dev *wdev, const struct hif_ind_rx *body = buf; if (!wvif) { - dev_warn(wdev->dev, "ignore rx data for non-existent vif %d\n", - hif->interface); - return 0; + dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", + __func__, hif->interface); + return -EIO; } skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); wfx_rx_cb(wvif, body, skb); @@ -128,8 +128,8 @@ static int hif_event_indication(struct wfx_dev *wdev, int type = le32_to_cpu(body->event_id); if (!wvif) { - dev_warn(wdev->dev, "received event for non-existent vif\n"); - return 0; + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; } switch (type) { @@ -161,7 +161,10 @@ static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } complete(&wvif->set_pm_mode_complete); return 0; @@ -173,7 +176,11 @@ static int hif_scan_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + wfx_scan_complete(wvif); return 0; @@ -185,7 +192,10 @@ static int hif_join_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } dev_warn(wdev->dev, "unattended JoinCompleteInd\n"); return 0; @@ -195,11 +205,15 @@ static int hif_suspend_resume_indication(struct wfx_dev *wdev, const struct hif_msg *hif, const void *buf) { - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_suspend_resume_tx *body = buf; + struct wfx_vif *wvif; if (body->bc_mc_only) { - WARN_ON(!wvif); + wvif = wdev_to_wvif(wdev, hif->interface); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } if (body->resume) wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE); else diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index a246f0d1d6e9..2320a81eae0b 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -619,6 +619,10 @@ int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) struct wfx_sta_priv *sta_dev = (struct wfx_sta_priv *)&sta->drv_priv; struct wfx_vif *wvif = wdev_to_wvif(wdev, sta_dev->vif_id); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } schedule_work(&wvif->update_tim_work); return 0; } From patchwork Fri Oct 9 17:13:03 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: 287850 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 0BECAC43457 for ; Fri, 9 Oct 2020 17:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C50C222265 for ; Fri, 9 Oct 2020 17:14:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="o82f8+3I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733251AbgJIROQ (ORCPT ); Fri, 9 Oct 2020 13:14:16 -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 S2390102AbgJIRNn (ORCPT ); Fri, 9 Oct 2020 13:13:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wb0t7e+G+YmPOUJUALP+aE7crrYqPZEGTYtSCAYXI/Qwbom8TXNtLqSrTv+A/1FgHRSuOj11ZTt36bHLdkNk18Br511Nyl02uz8Gr9auYlUEhipZpa83J6tSslahqGEmLRFR3vDfbv9Kr3N7E4hCgUxUJjQWJ8q8zFKW2bfl9VxkrFaZ+kFzBS2e0IS6dunFE3bW69d0kxUdLnJwRpZeUKnLnhw30FmoUBz3/BTOtLl/eKcZodbyAbcz4BGDswEgQGWDAVjc8qRE642ZtwVj0UARqLVndOX5NGFSW+evj7QmKLOXaIbwioAe6Hx7wR11M0UXubQUwRC69aoctlaVnA== 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=dSt2vbIr2iX+8KYioDJs37B0bMyliE1X+LgFMy1ISgU=; b=oWio+ASIz6PIqPHcIP2st6+COKVt5wiwPL+NtgejWQ5jXSnHNuLSq/zWUfgMPjmUYOiJDD/X1STaLIGT6YU2tflRM14g4bmuzEC5zsDByviClV7zl2m7eQ+1giLOjpfprDG2yV7SwY9DSsFHGWEc2JhijQlUbvsbWoHHm7aUqzJ9yT7uttEWxRa4Z/xJMQyE4KyYjiOwoslEE+IM3wl21y4YuANUEEkSSWc2snxyFETAo3GbqVHsMXwAI+GvANJ/rw1y0dl3oGTFOYkR4EGLxMKNQssd6DLA8AEcpVp/kvRH/G5Ucws/1UoSpSKVZiofmc+f0jY5fmbmPpGx3JhXXg== 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=dSt2vbIr2iX+8KYioDJs37B0bMyliE1X+LgFMy1ISgU=; b=o82f8+3I1koBBpNbqNeQUHFCgx8Ee/7DbiUObRSLSLbYOGG5It+M2d0pM58JB8cY0bPe7QCCbA6ScWeRvmFPXMxqLlCaDA6hAxixi0R064cZsHWxcfwj3nqDwK6Mic4SRSYZpS9WhkE3NN7Q4wQQ28tpBYFc2UcIDYxJKzGkNqo= 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:29 +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:29 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH 4/8] staging: wfx: wfx_init_common() returns NULL on error Date: Fri, 9 Oct 2020 19:13:03 +0200 Message-Id: <20201009171307.864608-5-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:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88c95c4b-e0c1-46c0-eeac-08d86c76a476 X-MS-TrafficTypeDiagnostic: SN6PR11MB3455: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:392; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6F7w/PQgjMpjhZITDYNLJKg83WogApdq/x1BcAwhMUEvuqS0BtMIfj8UwWlrfCASKWatadIvJlNHjgiVlsn/uISxRKao0AI17b+F0BWuDdXI5B71THwlP9ApEQCE80czl0cu3uXmkgZhCJbXffKFGA6lSBUr2t8CNXnL6oL2uDq535sPy+5Mg7f59dap3Pjv1yY24qwXu5sMGzg5b+mHHejKzBYGq2GsLc/piW9iGpTiZ2LAARiOGtQcD3wckrg7l0Tux8SjS6Qlw81aUDy2p6ILmHbOaMaWfNdx/hXeEI8Mmp2GgP3RzjIvtAJ7JUfKzz3DFlQq7VbbPsZb8QPG2A== 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)(66574015)(86362001)(4326008)(66946007)(66556008)(66476007)(6666004)(107886003)(26005)(16526019)(2616005)(83380400001)(186003)(8676002)(956004)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: P131R5G5cMUPWoR32FkNYMR9qVowtJogi/NJDntiDzN8rSQjdKmXR8rGX3w6VQ5Fwo2YagACEBHEdqosYlvmS3hPGWp6HvT3kpUttSNuiKyNzD4/8YmCzg4COMjaLGwQjdmK2mmbHzpgrKbPSLWY9IrA0adt+LR4iWMTqvqRFEADvEjaYwoZD9Gi0iAzrXtBqOGaKT7awusU5vA9hdp4ERhh57svpP14PdcsDGg8rSxZhbM+pNiSc4gGvXjsmJQuAZwPRH4CB8/YPp8Ldu+drHL1WQI6O636KVfO2nYctkhvRy+W159Mq18sXgGxF6MuEZU0uLzd0JYHNCZILs9Pve3SRrrgyhU6h707lPRuuOIFGcpoc9Gmk+oJSvMDR7LOIAZLKyNz8qZwS5gIE2j9H8qMGtfkXXI3SPL8rRoVoNA6FuIHmWXr6j1Z/ZYxcAIGicfV8F6jY+lhISbmTFPsXKYLtECh+5GpP/A8SnWw+42XZkUB1yh10Rt1Kphhe1s4oqI1ggtLD6uudVko/GxxjG1v4YVDccrBon3ZyMT2ybrFh3EuavY4xm1r4JKPeQHf6Fmye51aXfsqb89LcvL67ZoZ5vC77wMNrBIbUMTiQQnKMJ0WgG3hrQD5SWhGEhsMC+kR2ZgoACV9v2hzBSzucg== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88c95c4b-e0c1-46c0-eeac-08d86c76a476 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:29.6502 (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: Fh3NTCZoN1DLokwJ6xRP77qO8UIXi3ZX8tOl15CLELlDZywIGoEFNdglEqV82iesGfLlRexBUJESJ5WLM/nzIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3455 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Smatch complains: bus_spi.c:228 wfx_spi_probe() warn: 'bus->core' could be an error pointer bus_sdio.c:221 wfx_sdio_probe() warn: 'bus->core' could be an error pointer bus->core contains the result of wfx_init_common(). With this patch, wfx_init_common() returns a valid pointer or NULL. Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index a8dc2c033410..e7bc1988124a 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -309,7 +309,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", GPIOD_OUT_LOW); if (IS_ERR(wdev->pdata.gpio_wakeup)) - return ERR_CAST(wdev->pdata.gpio_wakeup); + return NULL; if (wdev->pdata.gpio_wakeup) gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup"); 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: 287851 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 D60FAC43457 for ; Fri, 9 Oct 2020 17:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 935D422265 for ; Fri, 9 Oct 2020 17:14:01 +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 S2390194AbgJIRN4 (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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= 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: linux-wireless@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; } From patchwork Fri Oct 9 17:13:07 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: 287852 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=ham 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 C4F13C433E7 for ; Fri, 9 Oct 2020 17:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AD6D22265 for ; Fri, 9 Oct 2020 17:13:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="CiuKDi6R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390154AbgJIRNo (ORCPT ); Fri, 9 Oct 2020 13:13:44 -0400 Received: from mail-eopbgr750058.outbound.protection.outlook.com ([40.107.75.58]:34017 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732874AbgJIRNn (ORCPT ); Fri, 9 Oct 2020 13:13:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EGVMiVl94j2vVEPE0rHXZT3SfMNjDUvh3aqi8n3zSieryTRxtD/Lf5mYVtb1SxygoY8M/TL1PkI41mjqGUpNESNpk8+ggFeZwjd3fuirXNt3n3o2FvfxcEBYdWlaSEA0Ax1G12PageeKOHJLrinGVXJw0QRIvBpReUWt6XPTPSHVrQyNY7IslJ7zHm3gdTHMt7Cjvy9J12G60fj2wL0TJHELqw9mM1fjr+k++NaxCo26o1Zq1BiHqoZRbgHLl65Rp+Y4luImmHCyergZIIhgDAR4be1YLoYMnwThDqw0k5G0lSyg2P2I5zot3RzIxLaS5KTjWQGfPEDEpaUp6tpmQQ== 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=H9C+nIAJ1Ffqm1I50uRTHzLfaztPt1wHruwY6oFnFbU=; b=gCizNDo5XlrFE5cZzion8KADijIt/Cd+ZKUoAUv+u6CJF9YTfJQ3ly9LDQlC/fxtahrZan7CpSqTgBLBg6rkU+Qevet+3n2WCbBg8P1p/wg4+Ypzy7fOu67x2BwFS/AYoJr+3AupTa0/j3Z7qDIqgmF8JIxUnfKomDURfOWEg7W4vmruH93j6uEL1Mk+diYrLVXkcixyPhjC+bH96zO2SwP8w4pTenTK/voPUFABr4jFkTx29ImsbhkOreX5Vnhbv3V+/IJcFmGtpsFSIMZ5gAIQY/p24ENiTmRUY5L/fGA7Q7Gi/yInGqzyKgOrA+Gm4qa8W9pVRInkGBANuO4fhw== 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=H9C+nIAJ1Ffqm1I50uRTHzLfaztPt1wHruwY6oFnFbU=; b=CiuKDi6Rbtb4mGhXUD6tfzecpNVHaZnReeZCO6JuYOWsb996IBH9A9kkKkmlIWWoiEqE9bzvdcCSXRHF1okCrjQvBXRdi6I/FOFtdL34UGDB5BmwUYvKfuiQo5kQORTYruJwC+odCeEAgEM8xf4l5ZBRISdOQ4L/Qy4TKgRMAEQ= 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 SN6PR11MB3087.namprd11.prod.outlook.com (2603:10b6:805:d3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32; Fri, 9 Oct 2020 17:13:37 +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:37 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH 8/8] staging: wfx: improve robustness of wfx_get_hw_rate() Date: Fri, 9 Oct 2020 19:13:07 +0200 Message-Id: <20201009171307.864608-9-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:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b1fcbf6-7a09-401e-3028-08d86c76a948 X-MS-TrafficTypeDiagnostic: SN6PR11MB3087: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:605; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hCzwWUKBOo+OzGc81x211GCOlkiUqy4bb9mX+dN7HA66AiI8BudLbrJwaaCv8/u+xvNYCkRSWI93Mc3fDBJ/x/gkBuVzuBC0TB2BTUsLgQFz9uoe8i/TGy0gcKjOHGKLDnej8Z3p8YWfhNSmKUo6/PcK6dyHVPvDzlPZ/W3Me+ZcTSHsF2oA2N650WFoGjBUgXgECKPWdN6IqADRfPyEMTIaz636UE9egvAAZUbRPeOD1NvCzUSmm12Ntbw4Ujea/xafPChNRDKw3ELpWcrGICqQsPwP6qK2uwdDpxUukBirwzf1uWn2ydEqEPfSAXUB 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:(396003)(39850400004)(136003)(376002)(346002)(366004)(7696005)(1076003)(2616005)(66476007)(36756003)(66556008)(956004)(478600001)(2906002)(6666004)(5660300002)(54906003)(316002)(6486002)(4326008)(86362001)(8676002)(66946007)(8936002)(52116002)(107886003)(186003)(26005)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: A9DOVVcnwFEVj6Wt2IkdU5ZywAmdTQOCDrcQTGyo0/xcBdwCv9WFpSLV/FD3HabQoIkL71v8V121V8EciSYoqcXljkE6IYr7VssYaM/U4MPJfAhYLgg+yErTUgkmIsRoLiQMTneClD07DtECs5y3dPuvv/o6A3QtaIKYCXun/PlrlZyadZcBT4GyjsFjq87Pdm/N2ZZbc9i4q2KDTaN8ejDRZ38ZQWmcFeKPsB0yS14DJbHMmrgZx0MD22eiJiXECIoZit99RgDGytEuyW4F6HewHTzbkhWt6AoTLHIPFDIW+XIuvz8jboqpAnOKmoAxu1bnXXZAn9cqunNoavTKseitm3DGifBvt5Zf+gdP9guMMqP83DSxu7/HgcjDesPVKxPCfreue02tlWeEUaG5OIy11YdLEges+YYQOKXelupbrfT7Uw2BYxcntznymkbLeDU8uEIZkn8+y2vIHiOoPRqb4nr23nLObJmo1UEMuCPetcDXegOGhB5HNVbRIB0UtP4rldNpAif0Qc6afhJTtKeA+IeDSsezt+9x2d+4W6w2CEC4Hss9tWxdjFh8LTCKbZkUlAhL4LEiMKVL9UGw7Ajpix3yGAVbtJ4EkJp3RdNQruQCKEoRqY4QlMdajr9Ee2W6Fo3WH8gQ3/sftSaqzw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b1fcbf6-7a09-401e-3028-08d86c76a948 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:37.7165 (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: JQ8E02dQnRBJg0JTHjA3zezDx0UH542T1w0y7XZCnEY8stl0JhKxjeAXwur66hoktJlov+yjvFCG9lF8AMmleg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3087 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Smatch complains: data_tx.c:37 wfx_get_hw_rate() warn: constraint '(struct ieee80211_supported_band)->bitrates' overflow 'band->bitrates' 0 <= abs_rl '0-127' user_rl '' required = '(struct ieee80211_supported_band)->n_bitrates' 23 struct ieee80211_supported_band *band; 24 25 if (rate->idx < 0) 26 return -1; 27 if (rate->flags & IEEE80211_TX_RC_MCS) { 28 if (rate->idx > 7) { 29 WARN(1, "wrong rate->idx value: %d", rate->idx); 30 return -1; 31 } 32 return rate->idx + 14; 33 } 34 // WFx only support 2GHz, else band information should be retrieved 35 // from ieee80211_tx_info 36 band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; 37 return band->bitrates[rate->idx].hw_value; Add a simple check to make Smatch happy. Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 8db0be08daf8..41f6a604a697 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -31,6 +31,10 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev, } return rate->idx + 14; } + if (rate->idx >= band->n_bitrates) { + WARN(1, "wrong rate->idx value: %d", rate->idx); + return -1; + } // WFx only support 2GHz, else band information should be retrieved // from ieee80211_tx_info band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];