Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l: cadence: Fix how unsued lanes are handled in 'csi2rx_start()'

The 2nd parameter of 'find_first_zero_bit()' is a number of bits, not of
bytes. So use 'csi2rx->max_lanes' instead of 'sizeof(lanes_used)'.

Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Christophe JAILLET and committed by
Mauro Carvalho Chehab
2eca8e4c 8dbdee8e

+1 -1
+1 -1
drivers/media/platform/cadence/cdns-csi2rx.c
··· 129 129 */ 130 130 for (i = csi2rx->num_lanes; i < csi2rx->max_lanes; i++) { 131 131 unsigned int idx = find_first_zero_bit(&lanes_used, 132 - sizeof(lanes_used)); 132 + csi2rx->max_lanes); 133 133 set_bit(idx, &lanes_used); 134 134 reg |= CSI2RX_STATIC_CFG_DLANE_MAP(i, i + 1); 135 135 }