]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: gadget: aspeed: Check suspend/resume callback existence
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 26 Jul 2019 05:05:34 +0000 (15:05 +1000)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 12 Aug 2019 05:54:48 +0000 (08:54 +0300)
.. before calling them

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/aspeed-vhub/dev.c

index 71e2416858fde658589a29ee18cc6836e09d3b2c..5f7e3b6de531eef3b3952f11ac8552e7dd70d514 100644 (file)
@@ -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);