From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: hwmon: remove redundant cast
Date: Sat, 27 Oct 2018 00:30:59 +0200 [thread overview]
Message-ID: <20181026223059.17652-1-linux@rasmusvillemoes.dk> (raw)
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 <linux@rasmusvillemoes.dk>
---
drivers/hwmon/hwmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 975c95169884..ea42c5ec40d9 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -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));
--
2.19.1.6.gbde171bbf5
next reply other threads:[~2018-10-26 22:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 22:30 Rasmus Villemoes [this message]
2018-10-27 17:32 ` [PATCH] drivers: hwmon: remove redundant cast Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181026223059.17652-1-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).