From patchwork Thu Jun 15 06:26:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9788123 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 5A19F60348 for ; Thu, 15 Jun 2017 06:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DDE5205FD for ; Thu, 15 Jun 2017 06:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 427C926538; Thu, 15 Jun 2017 06:26:57 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 EBD27205FD for ; Thu, 15 Jun 2017 06:26:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750948AbdFOG0z (ORCPT ); Thu, 15 Jun 2017 02:26:55 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:45335 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbdFOG0y (ORCPT ); Thu, 15 Jun 2017 02:26:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1497508014; x=1529044014; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=/EPjVBa+EAC4aLJkZUl1HMmBAl4KkMpCsXtFXsk7mTk=; b=h3O7EyQnNLQ3h+kOeMOOwIiQhG9VB+5YwF3HEO1v71rV5UlOi1asgjSY 7m2n3EXalP6p5mje/55E0x9wUTC7n4GOTS1R+9dpGuQBRYS7gPaXYDdbF Fo3zSy0C4OHRlMrBTOqnxEiF5sFTf6exAK3T6TviAglNamyuq68Hz94mH w=; X-IronPort-AV: E=Sophos;i="5.39,342,1493708400"; d="scan'208";a="293529362" Received: from unknown (HELO ironmsg02-L.qualcomm.com) ([10.53.140.109]) by wolverine01.qualcomm.com with ESMTP; 14 Jun 2017 23:26:53 -0700 Cc: Dedy Lansky , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez X-IronPort-AV: E=McAfee;i="5800,7501,8560"; a="946696269" X-MGA-submission: =?us-ascii?q?MDH4uC31d0TnOVrhBXt5syZ/o5N7n2X1Q9/VEb?= =?us-ascii?q?bvNAdQdByqKtQ3oYM7yAnfvAghVFPRMZrOYsbp7q6vBANAlbj1947S75?= =?us-ascii?q?0SKezvAPzYShqf6AE7MB27ny5uJIQDZtEGtshiiEdr63zuQTOWacmRGS?= =?us-ascii?q?JE?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg02-L.qualcomm.com with ESMTP; 14 Jun 2017 23:26:52 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v3 1/3] wil6210: prevent platform callbacks after uninit Date: Thu, 15 Jun 2017 09:26:46 +0300 Message-Id: <1497508008-9536-2-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497508008-9536-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1497508008-9536-1-git-send-email-qca_merez@qca.qualcomm.com> 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 From: Dedy Lansky After calling platform_ops.uninit() it is still possible to invoke platform callbacks. To prevent this, zero platform_ops right after invoking uninit. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/pcie_bus.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index bf9f265..a874d8d 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c @@ -191,6 +191,13 @@ static int wil_platform_rop_fw_recovery(void *wil_handle) return 0; } +static void wil_platform_ops_uninit(struct wil6210_priv *wil) +{ + if (wil->platform_ops.uninit) + wil->platform_ops.uninit(wil->platform_handle); + memset(&wil->platform_ops, 0, sizeof(wil->platform_ops)); +} + static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct wil6210_priv *wil; @@ -327,8 +334,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_disable_pdev: pci_disable_device(pdev); err_plat: - if (wil->platform_ops.uninit) - wil->platform_ops.uninit(wil->platform_handle); + wil_platform_ops_uninit(wil); if_free: wil_if_free(wil); @@ -357,8 +363,7 @@ static void wil_pcie_remove(struct pci_dev *pdev) pci_iounmap(pdev, csr); pci_release_region(pdev, 0); pci_disable_device(pdev); - if (wil->platform_ops.uninit) - wil->platform_ops.uninit(wil->platform_handle); + wil_platform_ops_uninit(wil); wil_if_free(wil); }