From 519346ecabd3c1d5821f076b5df1695ecfabe2f6 Mon Sep 17 00:00:00 2001 From: Siddharth Gupta Date: Mon, 14 Jun 2021 19:21:09 -0700 Subject: [PATCH] remoteproc: core: Move validate before device add We can validate whether the remoteproc is correctly setup before making the cdev_add and device_add calls. This saves us the trouble of cleaning up later on. Signed-off-by: Siddharth Gupta Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/1623723671-5517-3-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson --- drivers/remoteproc/remoteproc_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 9ad8c5f96500..b65fce32e88c 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2333,6 +2333,10 @@ int rproc_add(struct rproc *rproc) struct device *dev = &rproc->dev; int ret; + ret = rproc_validate(rproc); + if (ret < 0) + return ret; + /* add char device for this remoteproc */ ret = rproc_char_device_add(rproc); if (ret < 0) @@ -2342,10 +2346,6 @@ int rproc_add(struct rproc *rproc) if (ret < 0) return ret; - ret = rproc_validate(rproc); - if (ret < 0) - return ret; - dev_info(dev, "%s is available\n", rproc->name); /* create debugfs entries */