Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225336

Re: [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data

From Krzysztof Opasiak <k.opasiak@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data
Date 2015-09-15 17:50 +0200
Message-ID <q90Ey-Jd-11@gated-at.bofh.it> (permalink)
References <q8Zp8-7qt-7@gated-at.bofh.it> <q8Zpb-7qt-83@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 09/15/2015 04:26 PM, Robert Baldyga wrote:
> Since ep->driver_data is not used for endpoint claiming, neither for
> enabled/disabled state storing, we can reduce number of places where
> we read or modify it's value, as now it has no particular meaning for
> function or framework logic.
>
> In case of f_ecm, ep->driver_data was used only for endpoint claiming
> and marking endpoints as enabled, so we can simplify code by reducing
> it.
>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>

( ... )

>
> @@ -820,14 +811,6 @@ fail:
>   		usb_ep_free_request(ecm->notify, ecm->notify_req);
>   	}
>
> -	/* we might as well release our claims on endpoints */
> -	if (ecm->notify)
> -		ecm->notify->driver_data = NULL;
> -	if (ecm->port.out_ep)
> -		ecm->port.out_ep->driver_data = NULL;
> -	if (ecm->port.in_ep)
> -		ecm->port.in_ep->driver_data = NULL;
> -
>   	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
>
>   	return status;
>

You have done this in almost all functions but personally I'm really 
concern about this change.

By convention function should free all allocated resources when exiting 
with non 0 code. Endpoints are some kind of resources, they are 
"allocated" using usb_ep_autoconfig() and if you are not going to use 
them because error occurred you should free the using 
usb_ep_autoconfig_release(). Moreover, you have done this in source sink 
function so why not do this in all other?


Best regards,
-- 
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:30 +0200
  Re: [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver  data Krzysztof Opasiak <k.opasiak@samsung.com> - 2015-09-15 17:50 +0200
    Re: [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver  data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-16 11:50 +0200

csiph-web