]> www.infradead.org Git - users/jedix/linux-maple.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)
committerMark Brown <broonie@kernel.org>
Mon, 30 Sep 2024 21:31:39 +0000 (22:31 +0100)
commitfa8ecda9876ac1e7b29257aa82af1fd0695496e2
treeb0f034f408f8bacf0b276aebdb76fc7ce3b7ff54
parent9852d85ec9d492ebef56dc5f229416c925758edc
spi: spi-fsl-lpspi: Adjust type of scldiv

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>
drivers/spi/spi-fsl-lpspi.c