public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: alokbarsode@gmail.com
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.com, Alok Barsode <alok.barsode@azingo.com>
Subject: [PATCH 1/3] Do not exit if adapter_ops setup fails.
Date: Mon,  4 May 2009 20:38:12 +0530	[thread overview]
Message-ID: <1241449694-17135-1-git-send-email-alok.barsode@azingo.com> (raw)

From: Alok Barsode <alok.barsode@azingo.com>

---
 src/adapter.c |   15 ++++++++++-----
 src/main.c    |    5 +----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index df85f6b..7ac361b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -406,9 +406,11 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode)
 	scan_enable = mode2scan(new_mode);
 
 	if (!adapter->up && scan_enable != SCAN_DISABLED) {
-		err = adapter_ops->start(adapter->dev_id);
-		if (err < 0)
-			return err;
+		if (adapter_ops) {
+			err = adapter_ops->start(adapter->dev_id);
+			if (err < 0)
+				return err;
+		}
 	}
 
 	dd = hci_open_dev(adapter->dev_id);
@@ -3095,13 +3097,16 @@ int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops)
 
 void btd_adapter_cleanup_ops()
 {
-	adapter_ops->cleanup();
+	if (adapter_ops)
+		adapter_ops->cleanup();
 }
 
 int adapter_ops_setup()
 {
-	if (!adapter_ops)
+	if (!adapter_ops) {
+		error("Unable to initialize adapter operations");
 		return -EINVAL;
+	}
 
 	return adapter_ops->setup();
 }
diff --git a/src/main.c b/src/main.c
index 884257f..8dd2cee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -412,10 +412,7 @@ int main(int argc, char *argv[])
 
 	event_loop = g_main_loop_new(NULL, FALSE);
 
-	if (adapter_ops_setup() < 0) {
-		error("adapter_ops_setup failed");
-		exit(1);
-	}
+	adapter_ops_setup();
 
 	starting = FALSE;
 
-- 
1.5.6.3


             reply	other threads:[~2009-05-04 15:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04 15:08 alokbarsode [this message]
2009-05-04 15:08 ` [PATCH 2/3] Code cleanup in adapter.c alokbarsode
2009-05-04 15:08   ` [PATCH 3/3] Adding stop() functionality to hciops plugin alokbarsode
2009-05-04 15:30     ` Johan Hedberg
2009-05-04 15:27   ` [PATCH 2/3] Code cleanup in adapter.c Johan Hedberg
2009-05-04 15:25 ` [PATCH 1/3] Do not exit if adapter_ops setup fails Johan Hedberg

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=1241449694-17135-1-git-send-email-alok.barsode@azingo.com \
    --to=alokbarsode@gmail.com \
    --cc=alok.barsode@azingo.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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