drivers: hwmon: remove redundant cast
PATCH 1/1 drivers: hwmon: remove redundant cast
struct attribute::name which this local variable name is eventually assigned to is "const char*", and so is the template parameter. We might as well preserve the constness all the way through.
Signed-off-by Rasmus Villemoes <[email protected]>
--- drivers/hwmon/hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/hwmon.c +2 -2
@@ -267,7 +267,7 @@ static struct attribute *hwmon_genattr(struct device *dev,struct device_attribute *dattr;struct attribute *a;umode_t mode; -char *name; +const char *name;bool is_string =is_string_attr (type, attr);/* The attribute is invisible if there is no template string */
@@ -289,7 +289,7 @@ static struct attribute *hwmon_genattr(struct device *dev,return ERR_PTR (-ENOMEM );if (type == hwmon_chip) { - name = (char *)template; + name = template; }else {scnprintf (hattr->name,sizeof (hattr->name), template, index +hwmon_attr_base (type));
Signature · 1 line
2.19.1.6.gbde171bbf5
Quoted 5 lines · Rasmus Villemoes
struct
attribute::namewhich this local variable name is eventually assigned to is "const char*", and so is the template parameter. We might as well preserve the constness all the way through.Signed-off-by Rasmus Villemoes <[email protected]>
Applied to hwmon-next.
Note that the "drivers:" tag is unnecessary; I removed it when applying the patch.
Guenter
Quoted 26 lines
--- drivers/hwmon/hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/hwmon/hwmon.c +2
-2@@ -267,7 +267,7 @@ static struct attribute *hwmon_genattr(struct device *dev,struct device_attribute *dattr;struct attribute *a;umode_t mode; -char *name; +const char *name;bool is_string =is_string_attr (type, attr);/* The attribute is invisible if there is no template string */ @@ -289,7 +289,7 @@ static struct attribute *hwmon_genattr(struct device *dev,return ERR_PTR (-ENOMEM );if (type == hwmon_chip) { - name = (char *)template; + name = template; }else {scnprintf (hattr->name,sizeof (hattr->name), template, index +hwmon_attr_base (type));