linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Andy Shevchenko
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v1 01/10] spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
Date: Wed, 14 Oct 2015 23:12:16 +0300	[thread overview]
Message-ID: <1444853545-59868-2-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1444853545-59868-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

The following warning occurs when DW SPI is compiled as module and it's a PCI
device. On removal stage pcibios_free_irq() called earlier than free_irq() due
to the latter is called at managed resources free strage.

------------[ cut here ]------------
WARNING: CPU: 1 PID: 1003 at /home/andy/prj/linux/fs/proc/generic.c:575 remove_proc_entry+0x118/0x150()
remove_proc_entry: removing non-empty directory 'irq/38', leaking at least 'dw_spi1'
Modules linked in: spi_dw_midpci(-) spi_dw [last unloaded: dw_dmac_core]
CPU: 1 PID: 1003 Comm: modprobe Not tainted 4.3.0-rc5-next-20151013+ #32
 00000000 00000000 f5535d70 c12dc220 f5535db0 f5535da0 c104e912 c198a6bc
 f5535dcc 000003eb c198a638 0000023f c11b4098 c11b4098 f54f1ec8 f54f1ea0
 f642ba20 f5535db8 c104e96e 00000009 f5535db0 c198a6bc f5535dcc f5535df0
Call Trace:
 [<c12dc220>] dump_stack+0x41/0x61
 [<c104e912>] warn_slowpath_common+0x82/0xb0
 [<c11b4098>] ? remove_proc_entry+0x118/0x150
 [<c11b4098>] ? remove_proc_entry+0x118/0x150
 [<c104e96e>] warn_slowpath_fmt+0x2e/0x30
 [<c11b4098>] remove_proc_entry+0x118/0x150
 [<c109b96a>] unregister_irq_proc+0xaa/0xc0
 [<c109575e>] free_desc+0x1e/0x60
 [<c10957d2>] irq_free_descs+0x32/0x70
 [<c109b1a0>] irq_domain_free_irqs+0x120/0x150
 [<c1039e8c>] mp_unmap_irq+0x5c/0x60
 [<c16277b0>] intel_mid_pci_irq_disable+0x20/0x40
 [<c1627c7f>] pcibios_free_irq+0xf/0x20
 [<c13189f2>] pci_device_remove+0x52/0xb0
 [<c13f6367>] __device_release_driver+0x77/0x100
 [<c13f6da7>] driver_detach+0x87/0x90
 [<c13f5eaa>] bus_remove_driver+0x4a/0xc0
 [<c128bf0d>] ? selinux_capable+0xd/0x10
 [<c13f7483>] driver_unregister+0x23/0x60
 [<c10bad8a>] ? find_module_all+0x5a/0x80
 [<c1317413>] pci_unregister_driver+0x13/0x60
 [<f80ac654>] dw_spi_driver_exit+0xd/0xf [spi_dw_midpci]
 [<c10bce9a>] SyS_delete_module+0x17a/0x210

Explicitly call free_irq() at removal stage of the DW SPI driver.

Fixes: 04f421e7b0b1 (spi: dw: use managed resources)
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/spi/spi-dw.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 1153d36..254ffdf 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -571,10 +571,14 @@ EXPORT_SYMBOL_GPL(dw_spi_add_host);
 
 void dw_spi_remove_host(struct dw_spi *dws)
 {
+	struct spi_master *master = dws->master;
+
 	if (!dws)
 		return;
 	dw_spi_debugfs_remove(dws);
 
+	devm_free_irq(master->dev.parent, dws->irq, master);
+
 	if (dws->dma_ops && dws->dma_ops->dma_exit)
 		dws->dma_ops->dma_exit(dws);
 	spi_enable_chip(dws, 0);
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-14 20:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 20:12 [PATCH v1 00/10] spi: dw: bug fix and clean up series Andy Shevchenko
     [not found] ` <1444853545-59868-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-14 20:12   ` Andy Shevchenko [this message]
     [not found]     ` <1444853545-59868-2-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:29       ` [PATCH v1 01/10] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Mark Brown
2015-10-14 20:12   ` [PATCH v1 02/10] spi: dw: use plain struct device * at earlier ->probe() Andy Shevchenko
     [not found]     ` <1444853545-59868-3-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: use plain struct device * at earlier ->probe()" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 03/10] spi: dw: remove unneeded cr0 member of struct chip_data Andy Shevchenko
     [not found]     ` <1444853545-59868-4-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: remove unneeded cr0 member of struct chip_data" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 04/10] spi: dw: remove a NULL check when call ->remove() Andy Shevchenko
     [not found]     ` <1444853545-59868-5-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:32       ` Mark Brown
2015-10-14 20:12   ` [PATCH v1 05/10] spi: dw: remove bits_per_word member of struct chip_data Andy Shevchenko
     [not found]     ` <1444853545-59868-6-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: remove bits_per_word member of struct chip_data" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 06/10] spi: dw: eliminate speed variable in ->transfer_one() Andy Shevchenko
     [not found]     ` <1444853545-59868-7-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: eliminate speed variable in ->transfer_one()" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 07/10] spi: dw: eliminate unused threshold variables Andy Shevchenko
     [not found]     ` <1444853545-59868-8-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: eliminate unused threshold variables" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 08/10] spi: dw: introduce spi_shutdown_chip() Andy Shevchenko
     [not found]     ` <1444853545-59868-9-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw: introduce spi_shutdown_chip()" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 09/10] spi: dw-pci: remove unused pdev member from struct dw_spi_pci Andy Shevchenko
     [not found]     ` <1444853545-59868-10-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw-pci: remove unused pdev member from struct dw_spi_pci" to the spi tree Mark Brown
2015-10-14 20:12   ` [PATCH v1 10/10] spi: dw-mmio: convert to unified device property API Andy Shevchenko
     [not found]     ` <1444853545-59868-11-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-19 19:43       ` Applied "spi: dw-mmio: convert to unified device property API" to the spi tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444853545-59868-2-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).