]> git.hungrycats.org Git - linux/commitdiff
misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
authorDan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
Tue, 23 Feb 2016 09:48:45 +0000 (11:48 +0200)
committerJiri Slaby <jslaby@suse.cz>
Wed, 15 Jun 2016 13:51:46 +0000 (15:51 +0200)
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>
drivers/misc/ad525x_dpot.c

index 65fb74402c37bad9f6c017eed94a8de7b6a85beb..49811a8a1b07f601e2b078b72a6279d9e04523e7 100644 (file)
@@ -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);