Skip to content

Commit

Permalink
usb: gadget: aspeed: Check suspend/resume callback existence
Browse files Browse the repository at this point in the history
.. before calling them

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
ozbenh authored and Felipe Balbi committed Aug 12, 2019
1 parent ef9d346 commit 155940a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/udc/aspeed-vhub/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 155940a

Please sign in to comment.