]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: spi-fsl-lpspi: Adjust type of scldiv
authorStefan Wahren <wahrenst@gmx.net>
Mon, 30 Sep 2024 09:30:54 +0000 (11:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:03:38 +0000 (20:03 +0100)
commit8455230b1ba0df1a580c3d7a3a56a11540a86a4f
tree747b82d480b94b153ea899641aa1d8f81cd529d8
parent3946e07552de0cd6ea996fb11998ed1ecd67220d
spi: spi-fsl-lpspi: Adjust type of scldiv

[ Upstream commit fa8ecda9876ac1e7b29257aa82af1fd0695496e2 ]

The target value of scldiv is just a byte, but its calculation in
fsl_lpspi_set_bitrate could be negative. So use an adequate type to store
the result and avoid overflows. After that this needs range check
adjustments, but this should make the code less opaque.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20240930093056.93418-2-wahrenst@gmx.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-fsl-lpspi.c