aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@linuxtv.org>2011-05-08 19:03:34 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:30:56 -0400
commitaff8ab5cc11c2c14b7ae3bb38cbe012c43b7dcef (patch)
tree278e775b573333939aa87b023fa4d9ff87853404 /drivers/media/dvb
parent35d451b9990cf3386c515d371aafff5a0df46fd7 (diff)
[media] DVB: return meaningful error codes in dvb_frontend
- Return values should not be ORed. Abort early instead. - Return -EINVAL instead of -1. Signed-off-by: Andreas Oberritter <obi@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 31e2c0d45db3..95c3fec6ae40 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1325,12 +1325,12 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
1325 tvp->u.data = fe->dtv_property_cache.isdbs_ts_id; 1325 tvp->u.data = fe->dtv_property_cache.isdbs_ts_id;
1326 break; 1326 break;
1327 default: 1327 default:
1328 r = -1; 1328 return -EINVAL;
1329 } 1329 }
1330 1330
1331 dtv_property_dump(tvp); 1331 dtv_property_dump(tvp);
1332 1332
1333 return r; 1333 return 0;
1334} 1334}
1335 1335
1336static int dtv_property_process_set(struct dvb_frontend *fe, 1336static int dtv_property_process_set(struct dvb_frontend *fe,
@@ -1342,11 +1342,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1342 dtv_property_dump(tvp); 1342 dtv_property_dump(tvp);
1343 1343
1344 /* Allow the frontend to validate incoming properties */ 1344 /* Allow the frontend to validate incoming properties */
1345 if (fe->ops.set_property) 1345 if (fe->ops.set_property) {
1346 r = fe->ops.set_property(fe, tvp); 1346 r = fe->ops.set_property(fe, tvp);
1347 1347 if (r < 0)
1348 if (r < 0) 1348 return r;
1349 return r; 1349 }
1350 1350
1351 switch(tvp->cmd) { 1351 switch(tvp->cmd) {
1352 case DTV_CLEAR: 1352 case DTV_CLEAR:
@@ -1365,7 +1365,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1365 dprintk("%s() Finalised property cache\n", __func__); 1365 dprintk("%s() Finalised property cache\n", __func__);
1366 dtv_property_cache_submit(fe); 1366 dtv_property_cache_submit(fe);
1367 1367
1368 r |= dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND, 1368 r = dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
1369 &fepriv->parameters); 1369 &fepriv->parameters);
1370 break; 1370 break;
1371 case DTV_FREQUENCY: 1371 case DTV_FREQUENCY:
@@ -1480,7 +1480,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1480 fe->dtv_property_cache.isdbs_ts_id = tvp->u.data; 1480 fe->dtv_property_cache.isdbs_ts_id = tvp->u.data;
1481 break; 1481 break;
1482 default: 1482 default:
1483 r = -1; 1483 return -EINVAL;
1484 } 1484 }
1485 1485
1486 return r; 1486 return r;
@@ -1554,8 +1554,10 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1554 } 1554 }
1555 1555
1556 for (i = 0; i < tvps->num; i++) { 1556 for (i = 0; i < tvps->num; i++) {
1557 (tvp + i)->result = dtv_property_process_set(fe, tvp + i, file); 1557 err = dtv_property_process_set(fe, tvp + i, file);
1558 err |= (tvp + i)->result; 1558 if (err < 0)
1559 goto out;
1560 (tvp + i)->result = err;
1559 } 1561 }
1560 1562
1561 if(fe->dtv_property_cache.state == DTV_TUNE) 1563 if(fe->dtv_property_cache.state == DTV_TUNE)
@@ -1586,8 +1588,10 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1586 } 1588 }
1587 1589
1588 for (i = 0; i < tvps->num; i++) { 1590 for (i = 0; i < tvps->num; i++) {
1589 (tvp + i)->result = dtv_property_process_get(fe, tvp + i, file); 1591 err = dtv_property_process_get(fe, tvp + i, file);
1590 err |= (tvp + i)->result; 1592 if (err < 0)
1593 goto out;
1594 (tvp + i)->result = err;
1591 } 1595 }
1592 1596
1593 if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { 1597 if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) {