Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Ao Sun <ao.sun@transsion.com>
To: "ulf.hansson@linaro.org" <ulf.hansson@linaro.org>
Cc: "beanhuo@micron.com" <beanhuo@micron.com>,
	"avri.altman@sandisk.com" <avri.altman@sandisk.com>,
	"jens.wiklander@linaro.org" <jens.wiklander@linaro.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Hongyan Xia <hongyan.xia@transsion.com>,
	Jiazi Li <jiazi.li@transsion.com>, Ao Sun <ao.sun@transsion.com>
Subject: [PATCH] mmc: block: fix RPMB device unregister ordering
Date: Sun, 5 Jul 2026 10:59:24 +0000	[thread overview]
Message-ID: <20260705105843.168-1-ao.sun@transsion.com> (raw)

From: Ao Sun <ao.sun@transsion.com>

The child RPMB device holds a reference to its parent, so the
parent's release callback cannot be invoked if the child device
is still registered.

Remove rpmb_dev_unregister() from the parent release handler and
unregister the child RPMB device in the remove path before tearing
down the parent device.

Also delete the extra blank line between mmc_blk_remove_rpmb_part()
and {.

Signed-off-by: Jiazi Li <jiazi.li@transsion.com>
Signed-off-by: Ao Sun <ao.sun@transsion.com>
---
 drivers/mmc/core/block.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index c0ffe0817fd4..abd5ae4ef2ba 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2776,7 +2776,6 @@ static void mmc_blk_rpmb_device_release(struct device *dev)
 {
 	struct mmc_rpmb_data *rpmb = dev_get_drvdata(dev);
 
-	rpmb_dev_unregister(rpmb->rdev);
 	mmc_blk_put(rpmb->md);
 	ida_free(&mmc_rpmb_ida, rpmb->id);
 	kfree(rpmb);
@@ -2991,8 +2990,8 @@ static int mmc_blk_alloc_rpmb_part(struct mmc_card *card,
 }
 
 static void mmc_blk_remove_rpmb_part(struct mmc_rpmb_data *rpmb)
-
 {
+	rpmb_dev_unregister(rpmb->rdev);
 	cdev_device_del(&rpmb->chrdev, &rpmb->dev);
 	put_device(&rpmb->dev);
 }
-- 
2.34.1


             reply	other threads:[~2026-07-05 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 10:59 Ao Sun [this message]
2026-07-06  5:18 ` [PATCH] mmc: block: fix RPMB device unregister ordering Avri Altman

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=20260705105843.168-1-ao.sun@transsion.com \
    --to=ao.sun@transsion.com \
    --cc=avri.altman@sandisk.com \
    --cc=axboe@kernel.dk \
    --cc=beanhuo@micron.com \
    --cc=hongyan.xia@transsion.com \
    --cc=jens.wiklander@linaro.org \
    --cc=jiazi.li@transsion.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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