diff options
author | Greg Kroah-Hartman <gregkh@google.com> | 2016-08-17 16:44:11 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-09-02 14:20:56 +0200 |
commit | 1521eb6b6995dd8db57c96d36bc3c64b2a7da3b1 (patch) | |
tree | 6f2a14abddaf698541ca5fc23c6613e04cb306ab /drivers/staging/greybus | |
parent | fc994f0f8363eb4c50361800c7d2217eb0306014 (diff) |
greybus: es2: No need to check before freeing an urb
usb_kill_urb() and usb_free_urb() can be called with NULL pointers, so
no need to check before calling them.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/es2.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 4f10accbd50b..6cd3a6411ad3 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -911,6 +911,7 @@ static int check_urb_status(struct urb *urb) static void es2_destroy(struct es2_ap_dev *es2) { struct usb_device *udev; + struct urb *urb; int i; debugfs_remove(es2->apb_log_enable_dentry); @@ -918,10 +919,7 @@ static void es2_destroy(struct es2_ap_dev *es2) /* Tear down everything! */ for (i = 0; i < NUM_CPORT_OUT_URB; ++i) { - struct urb *urb = es2->cport_out_urb[i]; - - if (!urb) - break; + urb = es2->cport_out_urb[i]; usb_kill_urb(urb); usb_free_urb(urb); es2->cport_out_urb[i] = NULL; @@ -929,11 +927,7 @@ static void es2_destroy(struct es2_ap_dev *es2) } for (i = 0; i < NUM_ARPC_IN_URB; ++i) { - struct urb *urb = es2->arpc_urb[i]; - - if (!urb) - break; - usb_free_urb(urb); + usb_free_urb(es2->arpc_urb[i]); kfree(es2->arpc_buffer[i]); es2->arpc_buffer[i] = NULL; } |