pwm: lpss: Avoid potential overflow of base_unit
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sat, 28 Jan 2017 15:10:39 +0000 (17:10 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 30 Jan 2017 07:13:19 +0000 (08:13 +0100)
commit684309e5043efaaa94d9b4e65f53f7fdde1f6675
tree8f25bbc38fbe2e2c2ecb2c3f8b11aca68404853b
parent8d254a340efb12b40c4c1ff25a48a4f48f7bbd6b
pwm: lpss: Avoid potential overflow of base_unit

The resolution of base_unit is derived from base_unit_bits and thus must be
equal to (2^base_unit_bits - 1). Otherwise frequency and therefore base_unit
might potentially overflow.

Prevent the above by substracting 1 in all cases where base_unit_bits or
derivative is used.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-lpss.c