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

media: sunxi: sun6i_mipi_csi2.c/sun8i_a83t_mipi_csi2.c: clarify error handling

Both sun6i_mipi_csi2.c and sun8i_a83t_mipi_csi2.c have the same issue:
the comment before the ret = 0 assignment is incorrect, drop it and
always assign the result of the v4l2_subdev_call(..., 0) to ret.

In the disable label check for !on and set ret to 0 in that case.

This fixes two smatch warnings:

drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c:193 sun6i_mipi_csi2_s_stream() warn: missing error code 'ret'
drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c:225 sun8i_a83t_mipi_csi2_s_stream() warn: missing error code 'ret'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
e39cc496 21b1b679

+8 -6
+4 -3
drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
··· 182 182 unsigned int lanes_count = 183 183 csi2_dev->bridge.endpoint.bus.mipi_csi2.num_data_lanes; 184 184 unsigned long pixel_rate; 185 - /* Initialize to 0 to use both in disable label (ret != 0) and off. */ 186 - int ret = 0; 185 + int ret; 187 186 188 187 if (!source_subdev) 189 188 return -ENODEV; 190 189 191 190 if (!on) { 192 - v4l2_subdev_call(source_subdev, video, s_stream, 0); 191 + ret = v4l2_subdev_call(source_subdev, video, s_stream, 0); 193 192 goto disable; 194 193 } 195 194 ··· 280 281 return 0; 281 282 282 283 disable: 284 + if (!on) 285 + ret = 0; 283 286 phy_power_off(dphy); 284 287 sun6i_mipi_csi2_disable(csi2_dev); 285 288
+4 -3
drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
··· 214 214 unsigned int lanes_count = 215 215 csi2_dev->bridge.endpoint.bus.mipi_csi2.num_data_lanes; 216 216 unsigned long pixel_rate; 217 - /* Initialize to 0 to use both in disable label (ret != 0) and off. */ 218 - int ret = 0; 217 + int ret; 219 218 220 219 if (!source_subdev) 221 220 return -ENODEV; 222 221 223 222 if (!on) { 224 - v4l2_subdev_call(source_subdev, video, s_stream, 0); 223 + ret = v4l2_subdev_call(source_subdev, video, s_stream, 0); 225 224 goto disable; 226 225 } 227 226 ··· 312 313 return 0; 313 314 314 315 disable: 316 + if (!on) 317 + ret = 0; 315 318 phy_power_off(dphy); 316 319 sun8i_a83t_mipi_csi2_disable(csi2_dev); 317 320