coretemp: constify static data
Subsystems (2)
PATCH 1/1 coretemp: constify static data
These arrays won't ever be written to, so protect them from unintentional modification.
Signed-off-by Jan Beulich <[email protected]>
--- drivers/hwmon/coretemp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/coretemp.c +3 -3
@@ -442,15 +442,15 @@ static int create_core_attrs(struct temp int attr_no) {int err, i; -static ssize_t (*rd_ptr[TOTAL_ATTRS ]) (struct device *dev, +static ssize_t (*const rd_ptr[TOTAL_ATTRS ]) (struct device *dev,struct device_attribute *devattr,char *buf) = { show_label, show_crit_alarm, show_temp, show_tjmax, show_max_alarm, show_ttarget, show_tmin }; -static ssize_t (*rw_ptr[TOTAL_ATTRS ]) (struct device *dev, +static ssize_t (*const rw_ptr[TOTAL_ATTRS ]) (struct device *dev,struct device_attribute *devattr,const char *buf,size_t count) = {NULL ,NULL ,NULL ,NULL ,NULL , store_ttarget, store_tmin }; -static const char *names[TOTAL_ATTRS ] = { +static const char *const names[TOTAL_ATTRS ] = {"temp%d_label" ,"temp%d_crit_alarm" ,"temp%d_input" ,"temp%d_crit" ,"temp%d_max_alarm" ,"temp%d_max" ,
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
AppliedQuoted 21 lines · Jan Beulich
These arrays won't ever be written to, so protect them from unintentional modification.
Signed-off-by Jan Beulich <[email protected]>--- drivers/hwmon/coretemp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/hwmon/coretemp.c +1
-1@@ -442,15 +442,15 @@ static int create_core_attrs(struct temp int attr_no) {int err, i; -static ssize_t (*rd_ptr[TOTAL_ATTRS ]) (struct device *dev, +static ssize_t (*const rd_ptr[TOTAL_ATTRS ]) (struct device *dev,struct device_attribute *devattr,char *buf) = { show_label, show_crit_alarm, show_temp, show_tjmax, show_max_alarm, show_ttarget, show_tmin };
drivers/hwmon/coretemp.c static int create_core_attrs(struct temp · line 456
Quoted 10 lines
drivers/hwmon/coretemp.c +2
-2-static ssize_t (*rw_ptr[TOTAL_ATTRS ]) (struct device *dev, +static ssize_t (*const rw_ptr[TOTAL_ATTRS ]) (struct device *dev,struct device_attribute *devattr,const char *buf,size_t count) = {NULL ,NULL ,NULL ,NULL ,NULL , store_ttarget, store_tmin }; -static const char *names[TOTAL_ATTRS ] = { +static const char *const names[TOTAL_ATTRS ] = {"temp%d_label" ,"temp%d_crit_alarm" ,"temp%d_input" ,"temp%d_crit" ,"temp%d_max_alarm" ,"temp%d_max" ,
Applied.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors