diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-12-31 05:54:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-06 09:40:46 -0500 |
commit | 58fae6739f63344d255161900ba12ce7ceb88666 (patch) | |
tree | 7522e2dbacb45794c487f3f226be555a042f7052 /drivers | |
parent | ed3189cf989128fe283d6dbffbbae08b67d9e5bd (diff) |
[media] DVB: dvb_net_init: return -errno on error
dvb_net_init unconditionally returns 0. Callers such as
videobuf_dvb_register_frontend examine dvbnet->dvbdev instead of the
return value to tell whether the operation succeeded. If it has been
set to a valid pointer, success; if it was left equal to NULL,
failure.
Alas, there is an edge case where that logic does not work as well:
when network support has been compiled out (CONFIG_DVB_NET=n), we want
dvb_net_init and related operations to behave as no-ops and always
succeed, but there is no appropriate value to which to set dvb->dvbdev
to indicate this.
Let dvb_net_init return a meaningful error code, as preparation for
adapting callers to look at that instead.
The only immediate impact of this patch should be to make the few
callers that already check for an error code from dvb_net_init behave
a little more sensibly when it fails.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_net.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 93d9869e0f15..8766ce8c354d 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -1510,9 +1510,7 @@ int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet, | |||
1510 | for (i=0; i<DVB_NET_DEVICES_MAX; i++) | 1510 | for (i=0; i<DVB_NET_DEVICES_MAX; i++) |
1511 | dvbnet->state[i] = 0; | 1511 | dvbnet->state[i] = 0; |
1512 | 1512 | ||
1513 | dvb_register_device (adap, &dvbnet->dvbdev, &dvbdev_net, | 1513 | return dvb_register_device(adap, &dvbnet->dvbdev, &dvbdev_net, |
1514 | dvbnet, DVB_DEVICE_NET); | 1514 | dvbnet, DVB_DEVICE_NET); |
1515 | |||
1516 | return 0; | ||
1517 | } | 1515 | } |
1518 | EXPORT_SYMBOL(dvb_net_init); | 1516 | EXPORT_SYMBOL(dvb_net_init); |