FPGA validation can fail and return value needs to be checked.

Addresses-Coverity-ID: CID 583150: Null pointer dereferences  (NULL_RETURNS)
Signed-off-by: Michal Simek <michal.si...@amd.com>
---

(no changes since v1)

 drivers/fpga/xilinx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c
index 28c68faba55f..25b348648eff 100644
--- a/drivers/fpga/xilinx.c
+++ b/drivers/fpga/xilinx.c
@@ -50,6 +50,9 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t 
size,
        dataptr = (unsigned char *)fpgadata;
        /* Find out fpga_description */
        desc = fpga_validate(devnum, dataptr, 0);
+       if (!desc)
+               return FPGA_FAIL;
+
        /* Assign xilinx device description */
        xdesc = desc->devdesc;
 
-- 
2.43.0

Reply via email to