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>
This commit is contained in:
parent
69e273c0b0
commit
3f0d97d97f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue