]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:10 +0000 (16:02 +0200)
[ Upstream commit 11d5cb8b95456e2432dfee2ffcebf0623998493a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/common/firmware_if.c

index 334009e83823677b3779b805add6134c6783889e..b11e9830422ed1a927c2ed033df56826d174e5f1 100644 (file)
@@ -1370,8 +1370,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 09706c571e9503192efbe57ddf71b01de460cd9d..7a96c9753dbfbb8659da979f066fde9529468072 100644 (file)
@@ -803,11 +803,14 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
 
        if (!(hdev->fw_loading & 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");