[media] as102: fix error return code
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 5 Apr 2015 12:06:23 +0000 (09:06 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 1 May 2015 10:00:51 +0000 (07:00 -0300)
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>
drivers/media/usb/as102/as102_drv.c

index 8be1474b2c36fbf2df6080e62afbadae648de711..9dd7c7cb06b140d0d6355e01229155493bbbb29e 100644 (file)
@@ -337,6 +337,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
                                       &as102_dev->bus_adap,
                                       as102_dev->elna_cfg);
        if (!as102_dev->dvb_fe) {
+               ret = -ENODEV;
                dev_err(dev, "%s: as102_attach() failed: %d",
                    __func__, ret);
                goto efereg;