[PATCH 2/2] Fix check data device before register the modem

Zhenhua Zhang zhenhua.zhang at intel.com
Wed May 5 23:28:13 PDT 2010


To avoid the race condition that modem is registered before we retrieve
the data device property.
---
 plugins/udev.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 6850bf9..83468ce 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -98,7 +98,7 @@ static void add_mbm(struct ofono_modem *modem,
 					struct udev_device *udev_device)
 {
 	const char *desc, *devnode;
-	const char *device, *network;
+	const char *device, *data, *network;
 	int registered;
 
 	desc = udev_device_get_sysattr_value(udev_device, "device/interface");
@@ -144,9 +144,10 @@ static void add_mbm(struct ofono_modem *modem,
 	}
 
 	device  = ofono_modem_get_string(modem, MODEM_DEVICE);
+	data = ofono_modem_get_string(modem, DATA_DEVICE);
 	network = ofono_modem_get_string(modem, NETWORK_INTERFACE);
 
-	if (device != NULL && network != NULL) {
+	if (device != NULL && data != NULL && network != NULL) {
 		ofono_modem_set_integer(modem, "Registered", 1);
 		ofono_modem_register(modem);
 	}
-- 
1.6.3.3



More information about the ofono mailing list