public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Do not exit if adapter_ops setup fails.
@ 2009-05-04 15:08 alokbarsode
  2009-05-04 15:08 ` [PATCH 2/3] Code cleanup in adapter.c alokbarsode
  2009-05-04 15:25 ` [PATCH 1/3] Do not exit if adapter_ops setup fails Johan Hedberg
  0 siblings, 2 replies; 6+ messages in thread
From: alokbarsode @ 2009-05-04 15:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, Alok Barsode

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-04 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04 15:08 [PATCH 1/3] Do not exit if adapter_ops setup fails alokbarsode
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox