habanalabs: fix incorrect check on failed workqueue create
authorColin Ian King <colin.king@canonical.com>
Thu, 30 Jul 2020 08:20:22 +0000 (09:20 +0100)
committerOded Gabbay <oded.gabbay@gmail.com>
Sat, 22 Aug 2020 09:47:58 +0000 (12:47 +0300)
commit804d057cfae25c5447b36099fa59682d0d184ed6
tree0073a2ec0bb20a0404870bc8e1f8cacd65866055
parent58361aae4b0eed388680a89ac153d27177f40510
habanalabs: fix incorrect check on failed workqueue create

The null check on a failed workqueue create is currently null checking
hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
will never be true on a failed workqueue create. Fix this by checking
hdev->cq_wq[i].

Addresses-Coverity: ("Dereference before null check")
Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/common/device.c