From: Jonathan Nieder <jrnieder@gmail.com>
To: David Fries <david@fries.net>
Cc: Istvan Varga <istvan_v@mailbox.hu>,
linux-media@vger.kernel.org, Darron Broad <darron@kewl.org>,
Steven Toth <stoth@kernellabs.com>,
Hans Petter Selasky <hselasky@c2i.net>
Subject: [PATCH 1/9] [media] DVB: dvb_net_init: return -errno on error
Date: Sat, 31 Dec 2011 05:54:16 -0600 [thread overview]
Message-ID: <20111231115416.GC16802@elie.Belkin> (raw)
In-Reply-To: <20111231115117.GB16802@elie.Belkin>
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>
---
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,
for (i=0; i<DVB_NET_DEVICES_MAX; i++)
dvbnet->state[i] = 0;
- dvb_register_device (adap, &dvbnet->dvbdev, &dvbdev_net,
+ return dvb_register_device(adap, &dvbnet->dvbdev, &dvbdev_net,
dvbnet, DVB_DEVICE_NET);
-
- return 0;
}
EXPORT_SYMBOL(dvb_net_init);
--
1.7.8.2+next.20111228
next prev parent reply other threads:[~2011-12-31 11:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1RgiId-0003Qe-SC@www.linuxtv.org>
2011-12-31 11:51 ` [git:v4l-dvb/for_v3.3] [media] cx88-dvb avoid dangling core->gate_ctrl pointer Jonathan Nieder
2011-12-31 11:54 ` Jonathan Nieder [this message]
2011-12-31 17:37 ` [PATCH 1/9] [media] DVB: dvb_net_init: return -errno on error Darron Broad
2011-12-31 11:56 ` [PATCH 2/9] [media] videobuf-dvb: avoid spurious ENOMEM when CONFIG_DVB_NET=n Jonathan Nieder
2011-12-31 11:58 ` [PATCH 3/9] [media] dvb-bt8xx: use goto based exception handling Jonathan Nieder
2011-12-31 12:01 ` [PATCH 4/9] [media] ttusb-budget: use goto for " Jonathan Nieder
2011-12-31 12:04 ` [PATCH 5/9] [media] flexcop: handle errors from dvb_net_init Jonathan Nieder
2011-12-31 12:06 ` [PATCH 6/9] [media] dvb-bt8xx: " Jonathan Nieder
2011-12-31 12:08 ` [PATCH 7/9] [media] dm1105: " Jonathan Nieder
2011-12-31 12:10 ` [PATCH 8/9] [media] dvb-usb: " Jonathan Nieder
2011-12-31 12:19 ` [PATCH 9/9] [media] firedtv: " Jonathan Nieder
2011-12-31 12:38 ` Stefan Richter
2012-01-06 14:52 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111231115416.GC16802@elie.Belkin \
--to=jrnieder@gmail.com \
--cc=darron@kewl.org \
--cc=david@fries.net \
--cc=hselasky@c2i.net \
--cc=istvan_v@mailbox.hu \
--cc=linux-media@vger.kernel.org \
--cc=stoth@kernellabs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox