habanalabs: add missing error check in sysfs clk_freq_mhz_show
Add a missing error check in the sysfs show functions for clk_max_freq_mhz and clk_cur_freq_mhz_show. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
ca4c8e4e7b
commit
aa3e1f12a2
|
@ -18,6 +18,8 @@ static ssize_t clk_max_freq_mhz_show(struct device *dev, struct device_attribute
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, false);
|
value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, false);
|
||||||
|
if (value < 0)
|
||||||
|
return value;
|
||||||
|
|
||||||
hdev->asic_prop.max_freq_value = value;
|
hdev->asic_prop.max_freq_value = value;
|
||||||
|
|
||||||
|
@ -59,6 +61,8 @@ static ssize_t clk_cur_freq_mhz_show(struct device *dev, struct device_attribute
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, true);
|
value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, true);
|
||||||
|
if (value < 0)
|
||||||
|
return value;
|
||||||
|
|
||||||
return sprintf(buf, "%lu\n", (value / 1000 / 1000));
|
return sprintf(buf, "%lu\n", (value / 1000 / 1000));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue