linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zheyu Ma <zheyuma97@gmail.com>
To: andy@kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zheyu Ma <zheyuma97@gmail.com>
Subject: [PATCH v2] gpio: ml-ioh: Add devm_free_irq() call to remove flow
Date: Thu, 12 May 2022 20:47:55 +0800	[thread overview]
Message-ID: <20220512124755.2360648-1-zheyuma97@gmail.com> (raw)
In-Reply-To: <CAHp75Vfz-Qq3qo3Re7tsL0mfXNVYZYspGDFCDXhtZxwac7bEiw@mail.gmail.com>

When removing the module, we will get the following flaw:

[   14.204955] remove_proc_entry: removing non-empty directory 'irq/21', leaking at least 'gpio_ml_ioh'
[   14.205827] WARNING: CPU: 0 PID: 305 at fs/proc/generic.c:717 remove_proc_entry+0x389/0x3f0
[   14.209994] RIP: 0010:remove_proc_entry+0x389/0x3f0
[   14.217820] Call Trace:
[   14.218264]  unregister_irq_proc+0x14c/0x170
[   14.220206]  pci_disable_device+0x1ad/0x380
[   14.220613]  ioh_gpio_remove+0xc5/0xe0 [gpio_ml_ioh]

Fix this bug by adding devm_free_irq() call to remove flow.

Fixes: e971ac9a564a ("gpio: ml-ioh: use resource management for irqs")
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
Changes in v2:
    - Remove unimportant lines from the call trace.
    - Add the fixes tag.
---
 drivers/gpio/gpio-ml-ioh.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index b060c4773698..09bf317876b0 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -508,6 +508,8 @@ static void ioh_gpio_remove(struct pci_dev *pdev)
 	struct ioh_gpio *chip = pci_get_drvdata(pdev);
 	void *chip_save;
 
+	devm_free_irq(&pdev->dev, pdev->irq, chip);
+
 	chip_save = chip;
 
 	for (i = 0; i < 8; i++, chip++)
-- 
2.25.1


  reply	other threads:[~2022-05-12 12:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 11:21 [PATCH] gpio: ml-ioh: Add devm_free_irq() call to remove flow Zheyu Ma
2022-05-12 12:02 ` Andy Shevchenko
2022-05-12 12:47   ` Zheyu Ma [this message]
2022-05-14 12:50     ` [PATCH v2] " Bartosz Golaszewski
2022-05-14 13:04     ` Andy Shevchenko
2022-05-12 12:50   ` [PATCH] " Zheyu Ma

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=20220512124755.2360648-1-zheyuma97@gmail.com \
    --to=zheyuma97@gmail.com \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).