summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Bogdan Nechita <dan.bogdan.nechita@gmail.com>2016-02-23 11:48:45 +0200
committerJiri Slaby <jslaby@suse.cz>2016-06-15 15:51:46 +0200
commit174c1dfbfc54facaa6fd45c28f7ae9adfe6d0f78 (patch)
tree8bff99bbf2c6c6ccceb64283c4bd7be645b1a15d
parent77b3964ccf07da318dcdec09d6d211ca2e793813 (diff)
downloadlinux-stable-174c1dfbfc54facaa6fd45c28f7ae9adfe6d0f78.tar.gz
linux-stable-174c1dfbfc54facaa6fd45c28f7ae9adfe6d0f78.tar.bz2
linux-stable-174c1dfbfc54facaa6fd45c28f7ae9adfe6d0f78.zip
misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
commit 1bb850a1b7f68b66361e658e334f9fdf8231f17d upstream. Currently writing the attributes with "echo" will result in comparing: "enabled\n" with "enabled\0" and attribute is always set to false. Use the sysfs_streq() instead because it treats both NUL and new-line-then-NUL as equivalent string terminations. Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Oliver Neukum <oliver@neukum.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--drivers/misc/ad525x_dpot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 65fb74402c37..49811a8a1b07 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -458,7 +458,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
int err;
if (reg & DPOT_ADDR_OTP_EN) {
- if (!strncmp(buf, "enabled", sizeof("enabled")))
+ if (sysfs_streq(buf, "enabled"))
set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
else
clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);