Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

From: Gyungoh Yoo
Date: Wed Dec 03 2014 - 21:05:13 EST


On Wed, Dec 03, 2014 at 11:02:29AM +0100, Oliver Neukum wrote:
> On Wed, 2014-12-03 at 16:05 +0900, gyungoh@xxxxxxxxx wrote:
> > +static ssize_t sky81452_bl_store_enable(struct device *dev,
> > + struct device_attribute *attr, const char *buf, size_t
> > count)
> > +{
> > + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> > + unsigned long value;
> > + int ret;
> > +
> > + ret = kstrtoul(buf, 16, &value);
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> > + value << CTZ(SKY81452_EN));
>
> No range checking for value?

Avaiable range is from 0 to SKY81452_EN.
regmap_update_bits() is masking the value.

>
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + return count;
> > +}
>
> Regards
> Oliver
>
> --
> Oliver Neukum <oneukum@xxxxxxx>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/