summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jean-michel.hautbois@vodalys.com>2014-08-05 18:19:37 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 14:38:14 -0700
commit3f0d97d97f2b539cf9ac746be4ec097259e6a8d0 (patch)
treeabdaa471dee67507343ac4f4586306003e5e4e0c /drivers/misc
parent69e273c0b0a3c337a521d083374c918dc52c666f (diff)
downloadlinux-3f0d97d97f2b539cf9ac746be4ec097259e6a8d0.tar.bz2
Lattice ECP3 FPGA: Check firmware pointer
This patch corrects a lack of testing. If fw is NULL when calling firmware_load(), it results in a kernel oops. Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/lattice-ecp3-config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c
index 7ffdb589841e..7e1efd5f58f0 100644
--- a/drivers/misc/lattice-ecp3-config.c
+++ b/drivers/misc/lattice-ecp3-config.c
@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context)
u32 jedec_id;
u32 status;
+ if (fw == NULL) {
+ dev_err(&spi->dev, "Cannot load firmware, aborting\n");
+ return;
+ }
+
if (fw->size == 0) {
dev_err(&spi->dev, "Error: Firmware size is 0!\n");
return;