habanalabs: add terminating NULL to attrs arrays
authorDafna Hirschfeld <dhirschfeld@habana.ai>
Thu, 19 May 2022 07:54:30 +0000 (10:54 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:21 +0000 (09:09 +0300)
Arrays of struct attribute are expected to be NULL terminated.
This is required by API methods such as device_add_groups.
This fixes a crash when loading the driver for Goya device.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/sysfs.c
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya_hwmgr.c

index 9ebeb18..da81810 100644 (file)
@@ -73,6 +73,7 @@ static DEVICE_ATTR_RO(clk_cur_freq_mhz);
 static struct attribute *hl_dev_clk_attrs[] = {
        &dev_attr_clk_max_freq_mhz.attr,
        &dev_attr_clk_cur_freq_mhz.attr,
+       NULL,
 };
 
 static ssize_t vrm_ver_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -93,6 +94,7 @@ static DEVICE_ATTR_RO(vrm_ver);
 
 static struct attribute *hl_dev_vrm_attrs[] = {
        &dev_attr_vrm_ver.attr,
+       NULL,
 };
 
 static ssize_t uboot_ver_show(struct device *dev, struct device_attribute *attr,
index fba3222..25d735a 100644 (file)
@@ -9187,6 +9187,7 @@ static DEVICE_ATTR_RO(infineon_ver);
 
 static struct attribute *gaudi_vrm_dev_attrs[] = {
        &dev_attr_infineon_ver.attr,
+       NULL,
 };
 
 static void gaudi_add_device_attr(struct hl_device *hdev, struct attribute_group *dev_clk_attr_grp,
index 6580fc6..b595721 100644 (file)
@@ -359,6 +359,7 @@ static struct attribute *goya_clk_dev_attrs[] = {
        &dev_attr_pm_mng_profile.attr,
        &dev_attr_tpc_clk.attr,
        &dev_attr_tpc_clk_curr.attr,
+       NULL,
 };
 
 static ssize_t infineon_ver_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -375,6 +376,7 @@ static DEVICE_ATTR_RO(infineon_ver);
 
 static struct attribute *goya_vrm_dev_attrs[] = {
        &dev_attr_infineon_ver.attr,
+       NULL,
 };
 
 void goya_add_device_attr(struct hl_device *hdev, struct attribute_group *dev_clk_attr_grp,