Commit aff8ab5c authored by Andreas Oberritter's avatar Andreas Oberritter Committed by Mauro Carvalho Chehab

[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: default avatarAndreas Oberritter <obi@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 35d451b9
...@@ -1325,12 +1325,12 @@ static int dtv_property_process_get(struct dvb_frontend *fe, ...@@ -1325,12 +1325,12 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
tvp->u.data = fe->dtv_property_cache.isdbs_ts_id; tvp->u.data = fe->dtv_property_cache.isdbs_ts_id;
break; break;
default: default:
r = -1; return -EINVAL;
} }
dtv_property_dump(tvp); dtv_property_dump(tvp);
return r; return 0;
} }
static int dtv_property_process_set(struct dvb_frontend *fe, static int dtv_property_process_set(struct dvb_frontend *fe,
...@@ -1342,11 +1342,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe, ...@@ -1342,11 +1342,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
dtv_property_dump(tvp); dtv_property_dump(tvp);
/* Allow the frontend to validate incoming properties */ /* Allow the frontend to validate incoming properties */
if (fe->ops.set_property) if (fe->ops.set_property) {
r = fe->ops.set_property(fe, tvp); r = fe->ops.set_property(fe, tvp);
if (r < 0) if (r < 0)
return r; return r;
}
switch(tvp->cmd) { switch(tvp->cmd) {
case DTV_CLEAR: case DTV_CLEAR:
...@@ -1365,7 +1365,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe, ...@@ -1365,7 +1365,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
dprintk("%s() Finalised property cache\n", __func__); dprintk("%s() Finalised property cache\n", __func__);
dtv_property_cache_submit(fe); dtv_property_cache_submit(fe);
r |= dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND, r = dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
&fepriv->parameters); &fepriv->parameters);
break; break;
case DTV_FREQUENCY: case DTV_FREQUENCY:
...@@ -1480,7 +1480,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe, ...@@ -1480,7 +1480,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
fe->dtv_property_cache.isdbs_ts_id = tvp->u.data; fe->dtv_property_cache.isdbs_ts_id = tvp->u.data;
break; break;
default: default:
r = -1; return -EINVAL;
} }
return r; return r;
...@@ -1554,8 +1554,10 @@ static int dvb_frontend_ioctl_properties(struct file *file, ...@@ -1554,8 +1554,10 @@ static int dvb_frontend_ioctl_properties(struct file *file,
} }
for (i = 0; i < tvps->num; i++) { for (i = 0; i < tvps->num; i++) {
(tvp + i)->result = dtv_property_process_set(fe, tvp + i, file); err = dtv_property_process_set(fe, tvp + i, file);
err |= (tvp + i)->result; if (err < 0)
goto out;
(tvp + i)->result = err;
} }
if(fe->dtv_property_cache.state == DTV_TUNE) if(fe->dtv_property_cache.state == DTV_TUNE)
...@@ -1586,8 +1588,10 @@ static int dvb_frontend_ioctl_properties(struct file *file, ...@@ -1586,8 +1588,10 @@ static int dvb_frontend_ioctl_properties(struct file *file,
} }
for (i = 0; i < tvps->num; i++) { for (i = 0; i < tvps->num; i++) {
(tvp + i)->result = dtv_property_process_get(fe, tvp + i, file); err = dtv_property_process_get(fe, tvp + i, file);
err |= (tvp + i)->result; if (err < 0)
goto out;
(tvp + i)->result = err;
} }
if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment