Commit 3f0d97d9 authored by Jean-Michel Hautbois's avatar Jean-Michel Hautbois Committed by Greg Kroah-Hartman

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: default avatarJean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 69e273c0
...@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context) ...@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context)
u32 jedec_id; u32 jedec_id;
u32 status; u32 status;
if (fw == NULL) {
dev_err(&spi->dev, "Cannot load firmware, aborting\n");
return;
}
if (fw->size == 0) { if (fw->size == 0) {
dev_err(&spi->dev, "Error: Firmware size is 0!\n"); dev_err(&spi->dev, "Error: Firmware size is 0!\n");
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment