summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/remoteproc_sysfs.c
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2018-09-15 02:37:22 +0200
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-10-06 08:04:20 +0200
commitfaeadbb64094757150a8c2a3175ca418dbdd472c (patch)
tree9644cf26f3e593b01d8406477aa7a53b413615c0 /drivers/remoteproc/remoteproc_sysfs.c
parentremoteproc: qcom: q6v5-pil: Add PDC reset for modem on SDM845 SoCs (diff)
downloadlinux-faeadbb64094757150a8c2a3175ca418dbdd472c.tar.xz
linux-faeadbb64094757150a8c2a3175ca418dbdd472c.zip
remoteproc: Check for NULL firmwares in sysfs interface
The remoteproc framework provides a sysfs file 'firmware' for modifying the firmware image name from userspace. Add an additional check to ensure NULL firmwares are errored out right away, rather than getting a delayed error while requesting a firmware during the start of a remoteproc later on. Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_sysfs.c')
-rw-r--r--drivers/remoteproc/remoteproc_sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 47be411400e5..3a4c3d7cafca 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -48,6 +48,11 @@ static ssize_t firmware_store(struct device *dev,
}
len = strcspn(buf, "\n");
+ if (!len) {
+ dev_err(dev, "can't provide a NULL firmware\n");
+ err = -EINVAL;
+ goto out;
+ }
p = kstrndup(buf, len, GFP_KERNEL);
if (!p) {