spi: s3c64xx: avoid possible negative array index
authorTudor Ambarus <tudor.ambarus@linaro.org>
Wed, 7 Feb 2024 12:04:19 +0000 (12:04 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 8 Feb 2024 16:33:29 +0000 (16:33 +0000)
commita336d41bbea51e11e3e4f56bd3877a535c077129
tree61ae9810d82613dd7c0e24cc213714cf49e26d4d
parent7256d6bdd4fe0eac6d4bcd138c3d87f95f79c750
spi: s3c64xx: avoid possible negative array index

The platform id is used as an index into the fifo_lvl_mask array.
Platforms can come with a negative device ID, PLATFORM_DEVID_NONE (-1),
thus we risked a negative array index. Catch such cases and fail to
probe.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-6-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-s3c64xx.c