From patchwork Wed Jan 3 12:32:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10142279 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 7D9ED6035E for ; Wed, 3 Jan 2018 12:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E23928B37 for ; Wed, 3 Jan 2018 12:32:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6314C29043; Wed, 3 Jan 2018 12:32: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 D7C1028B37 for ; Wed, 3 Jan 2018 12:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751577AbeACMcz (ORCPT ); Wed, 3 Jan 2018 07:32:55 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:35106 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335AbeACMcz (ORCPT ); Wed, 3 Jan 2018 07:32:55 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C047460272; Wed, 3 Jan 2018 12:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514982774; bh=Y39FSuwMPSJg3ck74OEcbvPj+sf3GSlh4X0HM5tjYhY=; h=From:To:Cc:Subject:Date:From; b=QHMWatb2IcE9KrGZE2eclk5OuprRCktEk8MAjd0jLmZCCJ7G7NNh+9f3S4erBzD4p B+OuqZz1B539GQdZjsKkYXD4LtHNJ6xFTA50oIF/aBuIviUFhm3Hml6RJJs4rWpWvF fOJvG+fAM5PIFvWCgtH4YuDsMWCW/rsGT5dR0dcg= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2F767601D4; Wed, 3 Jan 2018 12:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514982774; bh=Y39FSuwMPSJg3ck74OEcbvPj+sf3GSlh4X0HM5tjYhY=; h=From:To:Cc:Subject:Date:From; b=QHMWatb2IcE9KrGZE2eclk5OuprRCktEk8MAjd0jLmZCCJ7G7NNh+9f3S4erBzD4p B+OuqZz1B539GQdZjsKkYXD4LtHNJ6xFTA50oIF/aBuIviUFhm3Hml6RJJs4rWpWvF fOJvG+fAM5PIFvWCgtH4YuDsMWCW/rsGT5dR0dcg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2F767601D4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: lee.jones@linaro.org, timur@codeaurora.org Cc: chris2553@googlemail.com, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, bhelgaas@google.com, rjw@rjwysocki.net, Sinan Kaya , linux-kernel@vger.kernel.org Subject: [PATCH V2] mfd: rtsx: release IRQ during shutdown Date: Wed, 3 Jan 2018 07:32:45 -0500 Message-Id: <1514982766-18012-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")' revealed a resource leak in rtsx_pci driver during shutdown. Issue shows up as a warning during shutdown as follows: remove_proc_entry: removing non-empty directory 'irq/17', leaking at least 'rtsx_pci' WARNING: CPU: 0 PID: 1578 at fs/proc/generic.c:572 remove_proc_entry+0x11d/0x130 Modules linked in ... Call Trace: unregister_irq_proc free_desc irq_free_descs mp_unmap_irq acpi_unregister_gsi_apic acpi_pci_irq_disable do_pci_disable_device pci_disable_device device_shutdown kernel_restart Sys_reboot Even though rtsx_pci driver implements a shutdown callback, it is not releasing the interrupt that it registered during probe. This is causing the ACPI layer to complain that the shared IRQ is in use while freeing IRQ. This code releases the IRQ to prevent resource leak and eliminate the warning. Link: https://bugzilla.kernel.org/show_bug.cgi?id=198141 Reported-by: Chris Clayton Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown") Signed-off-by: Sinan Kaya Reviewed-by: Rafael J. Wysocki Tested-by: Chris Clayton --- drivers/mfd/rtsx_pcr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 590fb9a..c3ed885 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c @@ -1543,6 +1543,9 @@ static void rtsx_pci_shutdown(struct pci_dev *pcidev) rtsx_pci_power_off(pcr, HOST_ENTER_S1); pci_disable_device(pcidev); + free_irq(pcr->irq, (void *)pcr); + if (pcr->msi_en) + pci_disable_msi(pcr->pci); } #else /* CONFIG_PM */