Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Guangshuo Li <lgs201920130244@gmail.com>
To: gregkh@linuxfoundation.org, mathias.nyman@intel.com,
	thierry.reding@kernel.org, jonathanh@nvidia.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	rosenp@gmail.com, kees@kernel.org, lgs201920130244@gmail.com,
	avorontsov@ru.mvista.com, linux-tegra@vger.kernel.org,
	jckuo@nvidia.com, eeodqql09@gmail.com, stern@rowland.harvard.edu,
	davidm@egauge.net
Subject: [PATCH 3/3] usb: max3421: Free transfer buffers on remove
Date: Thu, 24 Sep 2026 19:21:56 +0800	[thread overview]
Message-ID: <20260924112156.1564208-4-lgs201920130244@gmail.com> (raw)
In-Reply-To: <20260924112156.1564208-1-lgs201920130244@gmail.com>

max3421_probe() allocates max3421_hcd->tx and max3421_hcd->rx, but
max3421_remove() does not perform the matching kfree() calls after a
successful probe. The probe error path already releases both buffers.

Free the TX and RX buffers in max3421_remove() after stopping the SPI
thread and releasing the IRQ, before dropping the HCD reference.

Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/usb/host/max3421-hcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 73e76d0e6973..994e8a07538d 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1950,6 +1950,8 @@ max3421_remove(struct spi_device *spi)
 	spin_unlock_irqrestore(&max3421_hcd->lock, flags);
 
 	free_irq(spi->irq, hcd);
+	kfree(max3421_hcd->tx);
+	kfree(max3421_hcd->rx);
 
 	usb_put_hcd(hcd);
 }
-- 
2.43.0


      parent reply	other threads:[~2026-09-24 11:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 11:21 [PATCH 0/3] usb: host: balance resource lifetimes in host drivers Guangshuo Li
2026-09-24 11:21 ` [PATCH 1/3] usb: fhci: release IRQ and MMIO mappings on remove Guangshuo Li
2026-09-24 11:21 ` [PATCH 2/3] usb: xhci: tegra: release padctl node reference after probe Guangshuo Li
2026-09-24 11:21 ` Guangshuo Li [this message]

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=20260924112156.1564208-4-lgs201920130244@gmail.com \
    --to=lgs201920130244@gmail.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=davidm@egauge.net \
    --cc=eeodqql09@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jckuo@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rosenp@gmail.com \
    --cc=stern@rowland.harvard.edu \
    --cc=thierry.reding@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