greybus: es2: clean up es2 destructor
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 4 Nov 2015 17:55:23 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 5 Nov 2015 04:35:18 +0000 (20:35 -0800)
Now that the host-device is deregistered separately from deallocation,
we can simplify the cport_to_ep-array deallocation.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/es2.c

index aad6451d90deb2953ed2dcae57da022e8b860846..c1a6fe4513c69825941a0547f3a9f6ad3186b7d2 100644 (file)
@@ -550,7 +550,6 @@ static int check_urb_status(struct urb *urb)
 static void es2_destroy(struct es2_ap_dev *es2)
 {
        struct usb_device *udev;
-       int *cport_to_ep;
        int bulk_in;
        int i;
 
@@ -583,11 +582,11 @@ static void es2_destroy(struct es2_ap_dev *es2)
                }
        }
 
+       kfree(es2->cport_to_ep);
+
        udev = es2->usb_dev;
-       cport_to_ep = es2->cport_to_ep;
        gb_hd_put(es2->hd);
 
-       kfree(cport_to_ep);
        usb_put_dev(udev);
 }