提交 1521eb6b 编写于 作者: G Greg Kroah-Hartman

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: NJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
上级 fc994f0f
...@@ -911,6 +911,7 @@ static int check_urb_status(struct urb *urb) ...@@ -911,6 +911,7 @@ static int check_urb_status(struct urb *urb)
static void es2_destroy(struct es2_ap_dev *es2) static void es2_destroy(struct es2_ap_dev *es2)
{ {
struct usb_device *udev; struct usb_device *udev;
struct urb *urb;
int i; int i;
debugfs_remove(es2->apb_log_enable_dentry); debugfs_remove(es2->apb_log_enable_dentry);
...@@ -918,10 +919,7 @@ static void es2_destroy(struct es2_ap_dev *es2) ...@@ -918,10 +919,7 @@ static void es2_destroy(struct es2_ap_dev *es2)
/* Tear down everything! */ /* Tear down everything! */
for (i = 0; i < NUM_CPORT_OUT_URB; ++i) { for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
struct urb *urb = es2->cport_out_urb[i]; urb = es2->cport_out_urb[i];
if (!urb)
break;
usb_kill_urb(urb); usb_kill_urb(urb);
usb_free_urb(urb); usb_free_urb(urb);
es2->cport_out_urb[i] = NULL; es2->cport_out_urb[i] = NULL;
...@@ -929,11 +927,7 @@ static void es2_destroy(struct es2_ap_dev *es2) ...@@ -929,11 +927,7 @@ static void es2_destroy(struct es2_ap_dev *es2)
} }
for (i = 0; i < NUM_ARPC_IN_URB; ++i) { for (i = 0; i < NUM_ARPC_IN_URB; ++i) {
struct urb *urb = es2->arpc_urb[i]; usb_free_urb(es2->arpc_urb[i]);
if (!urb)
break;
usb_free_urb(urb);
kfree(es2->arpc_buffer[i]); kfree(es2->arpc_buffer[i]);
es2->arpc_buffer[i] = NULL; es2->arpc_buffer[i] = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册