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

[media] radio: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Julia Lawall and committed by
Mauro Carvalho Chehab
44b0c738 bfe40b79

+3 -1
+3 -1
drivers/media/radio/radio-timb.c
··· 138 138 i2c_get_adapter(pdata->i2c_adapter), pdata->tuner, NULL); 139 139 tr->sd_dsp = v4l2_i2c_new_subdev_board(&tr->v4l2_dev, 140 140 i2c_get_adapter(pdata->i2c_adapter), pdata->dsp, NULL); 141 - if (tr->sd_tuner == NULL || tr->sd_dsp == NULL) 141 + if (tr->sd_tuner == NULL || tr->sd_dsp == NULL) { 142 + err = -ENODEV; 142 143 goto err_video_req; 144 + } 143 145 144 146 tr->v4l2_dev.ctrl_handler = tr->sd_dsp->ctrl_handler; 145 147