Skip to contentSkip to conversation

gprs: Correctly set driver_attached

PATCH New Brian Ruptash 1 participant 1 message Apr 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gprs: Correctly set driver_attached

It seems to me gprs->driver_attached must always be set prior to calling gprs->driver->set_attached(), since if set_attached() fails the callback inverts driver_attached to revert to its prior state.

---
 src/gprs.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/gprs.c +3 -1
index e379f7b..6fffe73 100644
@@ -1593,8 +1593,8 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
 	gprs->flags |= GPRS_FLAG_ATTACHING;
 
-	gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs);
 	gprs->driver_attached = attach;
+	gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs);
 }
 
 static void netreg_status_changed(int status, int lac, int ci, int tech,
@@ -2178,6 +2178,8 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
 detach:
 	gprs->flags |= GPRS_FLAG_ATTACHING;
+
+	gprs->driver_attached = FALSE;
 	gprs->driver->set_attached(gprs, FALSE, gprs_attach_callback, gprs);
 }
 
Signature · 1 line
1.7.9.5