From: Dan Bogdan Nechita Date: Tue, 23 Feb 2016 09:48:45 +0000 (+0200) Subject: misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes X-Git-Tag: v3.16.49~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=982ff37658a22a7ebe715a197a912b3c3225fab8;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c index 46272b0ae2dd4..6890e726b04f9 100644 --- a/drivers/misc/ad525x_dpot.c +++ b/drivers/misc/ad525x_dpot.c @@ -457,7 +457,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);