public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: Robert Baldyga <r.baldyga@samsung.com>, balbi@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com,
	m.szyprowski@samsung.com, andrzej.p@samsung.com
Subject: Re: [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data
Date: Tue, 15 Sep 2015 17:45:58 +0200	[thread overview]
Message-ID: <55F83D36.7090208@samsung.com> (raw)
In-Reply-To: <1442327229-28320-6-git-send-email-r.baldyga@samsung.com>



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

  reply	other threads:[~2015-09-15 15:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 14:26 [PATCH 00/26] usb: gadget: encapsulate ep enable/disable Robert Baldyga
2015-09-15 14:26 ` [PATCH 01/26] usb: gadget: fix few outdated comments Robert Baldyga
2015-09-15 14:26 ` [PATCH 02/26] usb: gadget: f_ncm: obtain cdev from function instead of driver_data Robert Baldyga
2015-09-15 14:26 ` [PATCH 03/26] usb: gadget: epautoconf: add usb_ep_autoconfig_release() function Robert Baldyga
2015-09-15 14:26 ` [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Robert Baldyga
2015-09-15 15:37   ` Krzysztof Opasiak
2015-09-15 15:43     ` Felipe Balbi
2015-09-15 15:57       ` Robert Baldyga
2015-09-15 16:01         ` Felipe Balbi
2015-09-15 16:15       ` Krzysztof Opasiak
2015-09-15 16:30         ` Felipe Balbi
2015-09-15 14:26 ` [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data Robert Baldyga
2015-09-15 15:45   ` Krzysztof Opasiak [this message]
2015-09-16  9:49     ` Robert Baldyga
2015-09-15 14:26 ` [PATCH 06/26] usb: gadget: f_acm: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 07/26] usb: gadget: f_eem: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 08/26] usb: gadget: f_hid: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 09/26] usb: gadget: f_loopback: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 10/26] usb: gadget: f_mass_storage: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 11/26] usb: gadget: f_midi: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 12/26] usb: gadget: f_ncm: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 13/26] usb: gadget: f_obex: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 14/26] usb: gadget: f_phonet: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 15/26] usb: gadget: f_printer: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 16/26] usb: gadget: f_rndis: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 17/26] usb: gadget: f_serial: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 18/26] usb: gadget: f_sourcesink: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 19/26] usb: gadget: f_subset: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 20/26] usb: gadget: f_uac1: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 21/26] usb: gadget: f_uac2: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 22/26] usb: gadget: f_uvc: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 23/26] usb: gadget: u_ether: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 24/26] usb: gadget: u_serial: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 25/26] usb: gadget: legacy: dbgp: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 26/26] usb: gadget: legacy: tcm: " Robert Baldyga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F83D36.7090208@samsung.com \
    --to=k.opasiak@samsung.com \
    --cc=andrzej.p@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=r.baldyga@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox