Skip to content

Commit

Permalink
[media] videobuf-dvb: avoid spurious ENOMEM when CONFIG_DVB_NET=n
Browse files Browse the repository at this point in the history
videobuf_dvb_register_bus relies on dvb_net_init to set dvbnet->dvbdev
on success, but ever since commit fcc8e7d ("dvb_net: Simplify the
code if DVB NET is not defined"), ->dvbdev is left unset when
networking support is disabled.  Therefore in such configurations
videobuf_dvb_register_bus always returns failure, tripping
little-tested error handling paths and preventing the device from
being initialized and used.

Now that dvb_net_init returns a nonzero value on error, we can use
that as a more reliable error indication.  Do so.

Now your card be used with CONFIG_DVB_NET=n, and the kernel will pass
on a more useful error code describing what happened when
CONFIG_DVB_NET=y but dvb_net_init fails due to resource exhaustion.

Reported-by: David Fries <[email protected]>
Signed-off-by: Jonathan Nieder <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jrn authored and Mauro Carvalho Chehab committed Jan 6, 2012
1 parent 58fae67 commit 5c96ebb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/media/video/videobuf-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ static int videobuf_dvb_register_frontend(struct dvb_adapter *adapter,
}

/* register network adapter */
dvb_net_init(adapter, &dvb->net, &dvb->demux.dmx);
if (dvb->net.dvbdev == NULL) {
result = -ENOMEM;
result = dvb_net_init(adapter, &dvb->net, &dvb->demux.dmx);
if (result < 0) {
printk(KERN_WARNING "%s: dvb_net_init failed (errno = %d)\n",
dvb->name, result);
goto fail_fe_conn;
}
return 0;
Expand Down

0 comments on commit 5c96ebb

Please sign in to comment.