diff options
author | Peter Chiang <pchiang@nvidia.com> | 2015-09-25 18:04:17 +0800 |
---|---|---|
committer | Matthew Pedro <mapedro@nvidia.com> | 2015-10-14 09:02:08 -0700 |
commit | a71b1768148c325d5aa3ce40d1d9c5c1b577def3 (patch) | |
tree | 2f46def03759a18d768cf5ced929e1658d8a843d /drivers | |
parent | 47a725211f33fe6c1b984a72af57dd193b7cae1c (diff) |
usb: gadget: composite: Fix cdev null after rmmod
Avoid to disconnect gadget again after unbinding
bug 200141741
Change-Id: I6fadcb4c5b5262d861a865f24ba2d8666e126923
Signed-off-by: Peter Chiang <pchiang@nvidia.com>
Reviewed-on: http://git-master/r/805175
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Hui Fu <hfu@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/composite.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 024bba4345ed..e83078379b37 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2,7 +2,7 @@ * composite.c - infrastructure for Composite USB Gadgets * * Copyright (C) 2006-2008 David Brownell - * Copyright (c) 2013 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015 NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1520,6 +1520,9 @@ void composite_disconnect(struct usb_gadget *gadget) /* REVISIT: should we have config and device level * disconnect callbacks? */ + if (!cdev) + return; + spin_lock_irqsave(&cdev->lock, flags); if (cdev->config) reset_config(cdev); |