Skip to content

Commit

Permalink
habanalabs: set rc as 'valid' in case of intentional func exit
Browse files Browse the repository at this point in the history
[ Upstream commit 11d5cb8 ]

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>
  • Loading branch information
KobyElbaz authored and gregkh committed Jul 20, 2021
1 parent 275674c commit cce27a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions drivers/misc/habanalabs/common/device.c
Expand Up @@ -1334,8 +1334,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;

Expand Down
5 changes: 4 additions & 1 deletion drivers/misc/habanalabs/common/firmware_if.c
Expand Up @@ -1006,11 +1006,14 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,

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");
Expand Down

0 comments on commit cce27a7

Please sign in to comment.