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 <[email protected]>
Signed-off-by: Suman Anna <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
This commit is contained in:
Suman Anna 2018-09-14 19:37:22 -05:00 • committed by Bjorn Andersson
commit faeadbb640

View file

@ -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) {