habanalabs: set rc as 'valid' in case of intentional func exit
authorKoby Elbaz <kelbaz@habana.ai>
Thu, 10 Jun 2021 06:01:57 +0000 (09:01 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:42 +0000 (15:23 +0300)
fix the following smatch warnings:
hl_fw_static_init_cpu() warn: missing error code 'rc'

Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/common/firmware_if.c

index cbdf75b24cb4dfc2e24c5ace89976d455710f320..e56f5170e3385c14782024a5cc7e154e2667f0ec 100644 (file)
@@ -1360,8 +1360,9 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
        }
 
        /*
-        * From this point, in case of an error, add char devices and create
-        * sysfs nodes as part of the error flow, to allow debugging.
+        * From this point, override rc (=0) in case of an error to allow
+        * debugging (by adding char devices and create sysfs nodes as part of
+        * the error flow).
         */
        add_cdev_sysfs_on_err = true;
 
index d5d0db7fd6ef748cf6d008d8971d28ff59e68f43..ce87053d4fdedcd446f14102323159a1fd39e26a 100644 (file)
@@ -2393,11 +2393,14 @@ static int hl_fw_static_init_cpu(struct hl_device *hdev,
 
        if (!(hdev->fw_components & FW_TYPE_LINUX)) {
                dev_info(hdev->dev, "Skip loading Linux F/W\n");
+               rc = 0;
                goto out;
        }
 
-       if (status == CPU_BOOT_STATUS_SRAM_AVAIL)
+       if (status == CPU_BOOT_STATUS_SRAM_AVAIL) {
+               rc = 0;
                goto out;
+       }
 
        dev_info(hdev->dev,
                "Loading firmware to device, may take some time...\n");