summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/remoteproc_sysfs.c
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2021-03-12 17:24:50 +0100
committerBjorn Andersson <bjorn.andersson@linaro.org>2021-03-18 14:02:09 +0100
commit83d4e6712c3b1a7dd5b43251737ea3d7d0a460f4 (patch)
tree87e484c963dd07434fe2472c94e82cd86ebb385f /drivers/remoteproc/remoteproc_sysfs.c
parentremoteproc: Properly deal with a kernel panic when attached (diff)
downloadlinux-83d4e6712c3b1a7dd5b43251737ea3d7d0a460f4.tar.xz
linux-83d4e6712c3b1a7dd5b43251737ea3d7d0a460f4.zip
remoteproc: Properly deal with a start request when attached
This patch takes into account scenarios where a remote processor has been attached to when receiving a "start" command from sysfs. As with the case with the running state, the command can't be carried out if the remote processor is already in operation. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-15-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_sysfs.c')
-rw-r--r--drivers/remoteproc/remoteproc_sysfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 4f58be1e13c1..bbfa238e4707 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -194,7 +194,8 @@ static ssize_t state_store(struct device *dev,
int ret = 0;
if (sysfs_streq(buf, "start")) {
- if (rproc->state == RPROC_RUNNING)
+ if (rproc->state == RPROC_RUNNING ||
+ rproc->state == RPROC_ATTACHED)
return -EBUSY;
ret = rproc_boot(rproc);