i2c: aspeed: fix invalid clock parameters for very large divisors
authorBrendan Higgins <brendanhiggins@google.com>
Fri, 21 Sep 2018 23:30:50 +0000 (16:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:00:32 +0000 (18:00 +0100)
commit384bf41f4cf60dad4b202a506e34a991c78a3233
treed27c773bea70db45d8fdb65ef8a49939c569c192
parentf010f1618e937e0037e53302bb28d57511c30217
i2c: aspeed: fix invalid clock parameters for very large divisors

[ Upstream commit 17ccba67109cd0631f206cf49e17986218b47854 ]

The function that computes clock parameters from divisors did not
respect the maximum size of the bitfields that the parameters were
written to. This fixes the bug.

This bug can be reproduced with (and this fix verified with) the test
at: https://kunit-review.googlesource.com/c/linux/+/1035/

Discovered-by-KUnit: https://kunit-review.googlesource.com/c/linux/+/1035/
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-aspeed.c