From patchwork Tue Aug 29 12:16:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 9927235 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21EFC603B4 for ; Tue, 29 Aug 2017 12:17:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22A37288C9 for ; Tue, 29 Aug 2017 12:17:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17669288CB; Tue, 29 Aug 2017 12:17:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A567C288D0 for ; Tue, 29 Aug 2017 12:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbdH2MRM (ORCPT ); Tue, 29 Aug 2017 08:17:12 -0400 Received: from mail-dm3nam03on0075.outbound.protection.outlook.com ([104.47.41.75]:55935 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753323AbdH2MRK (ORCPT ); Tue, 29 Aug 2017 08:17:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ng+UkwD2MUzvArb5kprBS9SRdWIgs9tAJFEqmv708bo=; b=PnJhsImL/abpe4nuAl2YhA249OZ+mAgFQYL/DbIPRS183Q2XYl1eacCIei0UvsI/cAc94bYt4AAYQwBpfrRoOug8VPN04KEdYZ4zTRm52XbfiHwAbXL6Mxvzq90x0lW9rBTWjjw4bnmFsqwsbS8arYXR/lG3t7Bp36i4iNB3Jss= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BY2PR05MB1927.namprd05.prod.outlook.com (10.163.32.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.2; Tue, 29 Aug 2017 12:17:07 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich Subject: [PATCH 3/5] qtnfmac: modify qtnf_map_bar not to return NULL Date: Tue, 29 Aug 2017 15:16:21 +0300 Message-Id: <20170829121623.24761-4-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170829121623.24761-1-sergey.matyukevich.os@quantenna.com> References: <20170829121623.24761-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: HE1PR07CA0006.eurprd07.prod.outlook.com (10.160.74.144) To BY2PR05MB1927.namprd05.prod.outlook.com (10.163.32.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a56210c-9eb0-42fc-440e-08d4eed7dee1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR05MB1927; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1927; 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yha5fXfIwRRY478v64W6ealn8Mqihm6sv4bmS8u6kAPgw6fufnFwbS00b6luLESIT8ezkjh7Sx+z2GgQMeEUKkgz2Nc/TFdW9u7wbvWdQXfm36lN05YkwZ62H0JZXo1TuMfKh2vZxdY1aV53j75Sxs7hknVYenjWhKFhrW9G1FXDaEdC4m5bQosRq3CCfb2mIj69NPqNnH5RQwZiQUFAGJ/BPz2Q9vS9l4YQwJxNujVyrt9KQBAxQFfQLXt88uA/HllWf8zBJtKAgscA6mmL4Hoje5mNFLVUA2cZ+KpwKZ/oZ0zlJzXhdVMBKZeGxkuL2LUofLwdtzM89tUjJkhUlMcGSP7GZ0MEBTMi+2; 4:myQNpbVQGa6/0iPGJlgCgKB4TY//Elpk7biGmwi4oOcn3TKeTpWAiddCefKHLmkCWqsnL/FNyShPzqVTpE/o6c3NEmKZx6gsFV9ZtRUBONyxNWa0ZK+d+Cu9qas6vmRu63k+u1Abj781vdYFxmMUQLUbxMdxjA12sQRq9aqNI8JujoQqwfW0rFUifbKIb8bJSBNoIY+CpL0yjffxIDv3f0epWDPhumlJi6u7ksTFTCjLpdYr6V/Xr2kPYLEY9U1b X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6041248)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR05MB1927; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR05MB1927; X-Forefront-PRVS: 0414DF926F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39830400002)(189002)(199003)(2906002)(66066001)(5660300001)(6486002)(478600001)(305945005)(6116002)(3846002)(7350300001)(103116003)(33646002)(2361001)(106356001)(2351001)(105586002)(69596002)(575784001)(86362001)(42186005)(53416004)(7736002)(47776003)(6666003)(68736007)(50226002)(48376002)(50986999)(107886003)(25786009)(110136004)(76176999)(2950100002)(97736004)(6916009)(1076002)(50466002)(54906002)(36756003)(81156014)(189998001)(53936002)(101416001)(4326008)(8676002)(81166006)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB1927; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR05MB1927; 23:KBT11EPpaab+Cgcjsc61E3aEbk14sEqlc78KyirMA?= =?us-ascii?Q?hpFHFJgWnunQkQ9Z8Wnm+1xrL0UzZRjJS/fs3n6tEw+HHOMAmD6gBj8RsQDS?= =?us-ascii?Q?lSuODpQeCM+I60khjF/fepcXAWLgBBn3yZNnvPlwjx/vsIh8Aonf3MKGyqSK?= =?us-ascii?Q?6bRjHt2naZAKKSCOUu7rbDkc7ti8nnE7XlJQzYavjLTh2HYAdrEzNFFx/++C?= =?us-ascii?Q?I3GHu3PowkaQgh1/xuo58p1K889e2HTfcDaJoUvlST9zzYhMFdZpAzIlowbB?= =?us-ascii?Q?6fEYLv2NA7H0XonKGAN0Hk/HOQQbrcw1ETDQHOLf+GBe21DwtZ5vCIXI2WTT?= =?us-ascii?Q?PznhwLxd2uTgrCFctV/K2KJDRmnte+PTixEuKrdiaUH8TrfyamCrFXHxtlSc?= =?us-ascii?Q?THZBVQ7mAJdz5ckdjjv0NHx1v/4ZxN1qPCJrCWYLp7MXQhMGcRkmdAranIri?= =?us-ascii?Q?Q6IsNBI+p3YdxWLBJTL5zQsid9VLrqlVQMAwKJBcfCT4FhJe0yUcGrVcvmpB?= =?us-ascii?Q?9mk7UzVyexSH2o1IRV5PnMfqzZk7wrGc8cIom7nj06rrXbjQdNNIdFujmAQU?= =?us-ascii?Q?GcjY32CoUFDv6tDcFZdR2g3NYrjVbyUYzTwHo1izRhphcpvhm8y5Q9wVmIvc?= =?us-ascii?Q?RWewCIBLULOA7pejbDWi7nvcOdof57tYt4sB/FloYeK0qtLY3k3dC/b4LMyd?= =?us-ascii?Q?lTxS65LtiX2Pavh22Pbh0Faz9aLPg3wIvTcVHdkABavv4oq/JN2E6ccHVMNy?= =?us-ascii?Q?p5RlL5+W8HHrWHJkKreYkVPQzZALhE6GhSdO/0D5njm/AWd9H+eQDfctpqcK?= =?us-ascii?Q?LKHpoO4aSlwBU0W3shGYihR/dOJGi1Z1U7EdCPh6ckbU12I/YYuOAhnVtd7n?= =?us-ascii?Q?KPF1rTpeARBdhctExadntgMpkC5eZX2mkgv6NzWMkx0Sw1Xqf23SKS8fk4qp?= =?us-ascii?Q?uCkgUTNTigOUebUZwhApY4yC69ruMAMflM+Ffur1rGScEK5TMhjE2deYxwHB?= =?us-ascii?Q?Ky9/29Mec0lXMa0FAj5aJ2WwJ8JxZLkQjD7RNri0ypULNhdOv9tFFt3ypY4s?= =?us-ascii?Q?zdyAiwEpbMn7FSQZbXZfwbdWWTENjDCbhmL11zl7HmXFkKQKfzktpC2JnBoS?= =?us-ascii?Q?UbjGiB3t1g78ts+gBNj7LIHn3zh73fri7d2ecjaDRrNPwwvN3eNdXfu9e02k?= =?us-ascii?Q?n0xOzxelFzFK5IDTNOI1VGpgmaFJVRG29cmz5mh13Uzj4tU2Fx1fSOucjQxH?= =?us-ascii?Q?6yn8f0JZQFxuxT1RsM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1927; 6:WIJjeL7XPo4Ax9riqiILXymUMYtm7qOYLVgydPfSToUnYIoZvxGBiBrw72WM6QYU9nvB+08vhkcTCBn0skCylcPEU0qYsoQx5NIjMw/UczRCKRrtwtJAMF903rjRJLXpm49MB5DMzMJYRV2hCffKVBK9L9WQWLqGhucYEOjWJqv+6WX/ftoBeaCe29Ismu9Bh9u/bLOfMwcEqnNSjiejPHA5moBCzz2p13d97tYZVExcVvwZ/ZYvTWl65/rXdLhdeNc9Exx3TORsriHZ5bu9wbDUsnCvPJLeYmjWe6mt3jQkAXzvUjVDXS5wc9845NumaTZjRz7xacRkD8AC1AMXZw==; 5:2zFjWtStFIfoqvJGuSAi5SDUx56NXsfeOQfjYIxMS0Kq3ML+s3RV2f+jApU5p5Ag8TDQ/661csDf4o4f3JGN2r5lCW9cWO3nV9zOnCDPyOK/weLG7CGXc+gB0LW09KxwqtTo/kDKVDCEN6pv9+tCIw==; 24:dPhIT5aLYB/Mn3mDFiOefhRA6gubwInbRKcIibZ29r8WsA1Hol5ee8HaZKYj1+QZi0f5nHpxoNg1EfXn1El567xbH+0JewxEaW8BdL28p/U=; 7:gvF4cwf/Xzo6Ff5FZQqpKfxdj+6qUe7EcX4aaE1/mRDqvkA1poAW9jdYciPy7NCjT4vfFnXd1br7dlUVxL7/FB3kgFsmWzq1TsV/mpWtr8WNJgpVPhkbmNWGLkC2ZxZLprMfHI+rC8+kIJhZ0mTO35Qf8uZMoIXasvF6bhDgHtrCWfBKiiizltqRtef9U+yYSUMwECm5gcJMqfPXyGlIH4xdOWYQZBeUEAT7ONqZ+64= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2017 12:17:07.7797 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB1927 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP NULL is not a special type of success here but a error pointer. So it makes sense to check against NULL in qtnf_map_bar and return error code. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index fd552d64f943..bfbcd0bf75bf 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -184,8 +184,10 @@ static void __iomem *qtnf_map_bar(struct qtnf_pcie_bus_priv *priv, u8 index) return IOMEM_ERR_PTR(ret); busaddr = pci_resource_start(priv->pdev, index); - vaddr = pcim_iomap_table(priv->pdev)[index]; len = pci_resource_len(priv->pdev, index); + vaddr = pcim_iomap_table(priv->pdev)[index]; + if (!vaddr) + return IOMEM_ERR_PTR(-ENOMEM); pr_debug("BAR%u vaddr=0x%p busaddr=%pad len=%u\n", index, vaddr, &busaddr, (int)len); @@ -248,19 +250,19 @@ static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv) int ret = -ENOMEM; priv->sysctl_bar = qtnf_map_bar(priv, QTN_SYSCTL_BAR); - if (IS_ERR_OR_NULL(priv->sysctl_bar)) { + if (IS_ERR(priv->sysctl_bar)) { pr_err("failed to map BAR%u\n", QTN_SYSCTL_BAR); return ret; } priv->dmareg_bar = qtnf_map_bar(priv, QTN_DMA_BAR); - if (IS_ERR_OR_NULL(priv->dmareg_bar)) { + if (IS_ERR(priv->dmareg_bar)) { pr_err("failed to map BAR%u\n", QTN_DMA_BAR); return ret; } priv->epmem_bar = qtnf_map_bar(priv, QTN_SHMEM_BAR); - if (IS_ERR_OR_NULL(priv->epmem_bar)) { + if (IS_ERR(priv->epmem_bar)) { pr_err("failed to map BAR%u\n", QTN_SHMEM_BAR); return ret; }