mfd: Ensure value written by wm831x_set_bits() is within the mask
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 20 Jun 2011 11:25:58 +0000 (12:25 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 31 Jul 2011 21:28:23 +0000 (23:28 +0200)
Purely for defensiveness.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm831x-core.c

index 772fe584f3b822b1f92bd5d1046def37155aa82f..baae9e47bffb21fa3249843bfe391a641ce0ce61 100644 (file)
@@ -295,7 +295,7 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
                goto out;
 
        r &= ~mask;
-       r |= val;
+       r |= val & mask;
 
        ret = wm831x_write(wm831x, reg, 2, &r);