From: Dawei Li <dawei.li@linux.dev>
To: andersson@kernel.org, mathieu.poirier@linaro.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
dawei.li@linux.dev, set_pte_at@outlook.com
Subject: [PATCH v4 3/3] rpmsg: char: Merge cdev branches in rpmsg_eptdev_add()
Date: Tue, 18 Nov 2025 23:41:07 +0800 [thread overview]
Message-ID: <20251118154107.3100-4-dawei.li@linux.dev> (raw)
In-Reply-To: <20251118154107.3100-1-dawei.li@linux.dev>
There are two if(cdev) branches in rpmsg_eptdev_add(), merge them. Note
that cdev_device_add() still must be last one since dev->release()
doesn't reclaim cdev related resource.
Signed-off-by: Dawei Li <dawei.li@linux.dev>
---
drivers/rpmsg/rpmsg_char.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 56371899212f..505411029fe0 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -467,14 +467,6 @@ static int rpmsg_eptdev_add(struct rpmsg_eptdev *eptdev,
eptdev->chinfo = chinfo;
- if (cdev) {
- ret = ida_alloc_max(&rpmsg_minor_ida, RPMSG_DEV_MAX - 1, GFP_KERNEL);
- if (ret < 0)
- return ret;
-
- dev->devt = MKDEV(MAJOR(rpmsg_major), ret);
- }
-
/* Anonymous inode device still need device name for dev_err() and friends */
ret = ida_alloc(&rpmsg_ept_ida, GFP_KERNEL);
if (ret < 0)
@@ -485,6 +477,12 @@ static int rpmsg_eptdev_add(struct rpmsg_eptdev *eptdev,
ret = 0;
if (cdev) {
+ ret = ida_alloc_max(&rpmsg_minor_ida, RPMSG_DEV_MAX - 1, GFP_KERNEL);
+ if (ret < 0)
+ return ret;
+
+ dev->devt = MKDEV(MAJOR(rpmsg_major), ret);
+
ret = cdev_device_add(&eptdev->cdev, &eptdev->dev);
}
--
2.25.1
prev parent reply other threads:[~2025-11-18 15:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 15:41 [PATCH v4 0/3] Fixes and rework of rpmsg_eptdev_add() Dawei Li
2025-11-18 15:41 ` [PATCH v4 1/3] rpmsg: char: Fix WARN() in error path " Dawei Li
2025-11-19 4:07 ` Zhongqiu Han
2025-11-19 10:56 ` Dawei Li
2025-11-19 12:26 ` Zhongqiu Han
2025-11-19 17:14 ` Mathieu Poirier
2025-11-18 15:41 ` [PATCH v4 2/3] rpmsg: char: Rework of rpmsg_eptdev_add() and its callers Dawei Li
2025-11-19 13:03 ` Zhongqiu Han
2025-11-18 15:41 ` Dawei 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=20251118154107.3100-4-dawei.li@linux.dev \
--to=dawei.li@linux.dev \
--cc=andersson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=set_pte_at@outlook.com \
/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