wusb: fix oops when terminating a non-existant reservation
David Vrabel [Fri, 12 Dec 2008 13:25:21 +0000 (13:25 +0000)]
If a reservation was not established, do not try terminating it.

Signed-off-by: David Vrabel <david.vrabel@csr.com>

drivers/usb/wusbcore/reservation.c

index c37e4f8..4ed9736 100644 (file)
@@ -110,6 +110,9 @@ int wusbhc_rsv_establish(struct wusbhc *wusbhc)
  */
 void wusbhc_rsv_terminate(struct wusbhc *wusbhc)
 {
-       uwb_rsv_terminate(wusbhc->rsv);
-       uwb_rsv_destroy(wusbhc->rsv);
+       if (wusbhc->rsv) {
+               uwb_rsv_terminate(wusbhc->rsv);
+               uwb_rsv_destroy(wusbhc->rsv);
+               wusbhc->rsv = NULL;
+       }
 }