char *name;
        bool add_cdev_sysfs_on_err = false;
 
-       name = kasprintf(GFP_KERNEL, "hl%d", hdev->id / 2);
+       hdev->cdev_idx = hdev->id / 2;
+
+       name = kasprintf(GFP_KERNEL, "hl%d", hdev->cdev_idx);
        if (!name) {
                rc = -ENOMEM;
                goto out_disabled;
        if (rc)
                goto out_disabled;
 
-       name = kasprintf(GFP_KERNEL, "hl_controlD%d", hdev->id / 2);
+       name = kasprintf(GFP_KERNEL, "hl_controlD%d", hdev->cdev_idx);
        if (!name) {
                rc = -ENOMEM;
                goto free_dev;
        if (hdev->pdev)
                dev_err(&hdev->pdev->dev,
                        "Failed to initialize hl%d. Device is NOT usable !\n",
-                       hdev->id / 2);
+                       hdev->cdev_idx);
        else
                pr_err("Failed to initialize hl%d. Device is NOT usable !\n",
-                       hdev->id / 2);
+                       hdev->cdev_idx);
 
        return rc;
 }
 
  * @edma_binning: contains mask of edma engines that is received from the f/w which
  *                   indicates which edma engines are binned-out
  * @id: device minor.
- * @id_control: minor of the control device
+ * @id_control: minor of the control device.
+ * @cdev_idx: char device index. Used for setting its name.
  * @cpu_pci_msb_addr: 50-bit extension bits for the device CPU's 40-bit
  *                    addresses.
  * @is_in_dram_scrub: true if dram scrub operation is on going.
        u32                             edma_binning;
        u16                             id;
        u16                             id_control;
+       u16                             cdev_idx;
        u16                             cpu_pci_msb_addr;
        u8                              is_in_dram_scrub;
        u8                              disabled;