The return value of kmalloc() needs to be checked.
To avoid devdata->cmdrsp to be null in case of the failure of alloc.
Fixes: d2c3506be646 ("staging: unisys: Add s-Par visorhba")
Signed-off-by: Jiasheng Jiang <[email protected]>
---
drivers/staging/unisys/visorhba/visorhba_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 4455d26f7c96..a23c300447e9 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -1056,6 +1056,9 @@ static int visorhba_probe(struct visor_device *dev)
idr_init(&devdata->idr);
devdata->cmdrsp = kmalloc(sizeof(*devdata->cmdrsp), GFP_ATOMIC);
+ if (!devdata->cmdrsp)
+ goto err_debugfs_info;
+
visorbus_enable_channel_interrupts(dev);
scsi_scan_host(scsihost);
--
2.25.1