aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomer Tayar <ttayar@habana.ai>2022-01-12 11:20:41 +0200
committerOded Gabbay <ogabbay@kernel.org>2022-02-28 14:22:03 +0200
commitaa3e1f12a2c1d6e36ce18c153706c906306b2e2d (patch)
tree759090d5dde5faef2ab5bf771efc3d3bf914c508
parentca4c8e4e7b57eec403e9887cd8b47d2ff8c97811 (diff)
downloadiio-aa3e1f12a2c1d6e36ce18c153706c906306b2e2d.tar.gz
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>
-rw-r--r--drivers/misc/habanalabs/common/sysfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/sysfs.c b/drivers/misc/habanalabs/common/sysfs.c
index 3f220dd3b6b21..c665a3ac8876a 100644
--- a/drivers/misc/habanalabs/common/sysfs.c
+++ b/drivers/misc/habanalabs/common/sysfs.c
@@ -18,6 +18,8 @@ static ssize_t clk_max_freq_mhz_show(struct device *dev, struct device_attribute
return -ENODEV;
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;
@@ -59,6 +61,8 @@ static ssize_t clk_cur_freq_mhz_show(struct device *dev, struct device_attribute
return -ENODEV;
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));
}