gpu: ipu-v3: prg: avoid possible array underflow
authorArnd Bergmann <arnd@arndb.de>
Thu, 15 Mar 2018 16:19:57 +0000 (17:19 +0100)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 15 Mar 2018 16:52:08 +0000 (17:52 +0100)
commit746d024c3211813946b319411aeb2b47767f8fb0
tree86f0bc1cc53db5a1e462a26f8c4ae005509d9a10
parent0c8efd610b58cb23cefdfa12015799079aef94ae
gpu: ipu-v3: prg: avoid possible array underflow

gcc-8 reports that we access an array with a negative index
in an error case:

drivers/gpu/ipu-v3/ipu-prg.c: In function 'ipu_prg_channel_disable':
drivers/gpu/ipu-v3/ipu-prg.c:252:43: error: array subscript -22 is below array bounds of 'struct ipu_prg_channel[3]' [-Werror=array-bounds]

This moves the range check in front of the first time that
variable gets used.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-prg.c