[bug report] habanalabs: extend fatal messages to contain PCI info
Dan Carpenter
dan.carpenter at linaro.org
Mon May 22 07:49:25 UTC 2023
Hello Moti Haimovski,
The patch 2a0a839b6a28: "habanalabs: extend fatal messages to contain
PCI info" from Dec 29, 2022, leads to the following Smatch static
checker warning:
drivers/accel/habanalabs/common/device.c:2336 hl_device_init()
warn: address of NULL pointer 'hdev->pdev'
drivers/accel/habanalabs/common/device.c
2322 early_fini:
2323 device_early_fini(hdev);
2324 free_dev:
2325 put_device(hdev->dev_ctrl);
2326 put_device(hdev->dev);
2327 out_disabled:
2328 hdev->disabled = true;
2329 if (expose_interfaces_on_err)
2330 cdev_sysfs_debugfs_add(hdev);
2331 if (hdev->pdev)
^^^^^^^^^^
NULL check.
2332 dev_err(&hdev->pdev->dev,
2333 "Failed to initialize hl%d. Device %s is NOT usable !\n",
2334 hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
2335 else
--> 2336 pr_err("Failed to initialize hl%d. Device %s is NOT usable !\n",
2337 hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
^^^^^^^^^^^^^^^^^^
"hdev->pdev" is NULL here so this will crash.
2338
2339 return rc;
2340 }
regards,
dan carpenter
More information about the dri-devel
mailing list