Skip to content

Commit 804d057

Browse files
Colin Ian Kingogabbay
authored andcommitted
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: 5574cb2 ("habanalabs: Assign each CQ with its own work queue") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 58361aa commit 804d057

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/habanalabs/common/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
288288
for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
289289
snprintf(workq_name, 32, "hl-free-jobs-%u", i);
290290
hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
291-
if (hdev->cq_wq == NULL) {
291+
if (hdev->cq_wq[i] == NULL) {
292292
dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
293293
rc = -ENOMEM;
294294
goto free_cq_wq;

0 commit comments

Comments
 (0)