summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/udc/aspeed-vhub
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2019-07-26 08:05:34 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2019-08-12 08:54:48 +0300
commit155940a16d688b5376f7c955a5f53259c6fe5689 (patch)
tree568d53e8e4604820d50bef8faeefffe421629720 /drivers/usb/gadget/udc/aspeed-vhub
parentef9d34686bae33de38b0198a4c6c1a50daab31d7 (diff)
downloadlinux-155940a16d688b5376f7c955a5f53259c6fe5689.tar.xz
usb: gadget: aspeed: Check suspend/resume callback existence
.. before calling them Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/udc/aspeed-vhub')
-rw-r--r--drivers/usb/gadget/udc/aspeed-vhub/dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
index 71e2416858fd..5f7e3b6de531 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
@@ -458,7 +458,7 @@ static const struct usb_gadget_ops ast_vhub_udc_ops = {
void ast_vhub_dev_suspend(struct ast_vhub_dev *d)
{
d->suspended = true;
- if (d->driver) {
+ if (d->driver && d->driver->suspend) {
spin_unlock(&d->vhub->lock);
d->driver->suspend(&d->gadget);
spin_lock(&d->vhub->lock);
@@ -468,7 +468,7 @@ void ast_vhub_dev_suspend(struct ast_vhub_dev *d)
void ast_vhub_dev_resume(struct ast_vhub_dev *d)
{
d->suspended = false;
- if (d->driver) {
+ if (d->driver && d->driver->resume) {
spin_unlock(&d->vhub->lock);
d->driver->resume(&d->gadget);
spin_lock(&d->vhub->lock);