Hi,

On Sun, Sep 27, 2015 at 03:16:45AM +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <n...@linux-iscsi.org>
> 
> This patch adds the missing tcm_usbg_drop_nexus() to properly
> release tcm_usbg_nexus memory during typical ->fabric_drop_tpg()
> callback shutdown.
> 
> Also, fix up tcm_usbg_tpg_store_enable() return value to propigate
> usbg_attach() failure up to user-space if no HDC is found.
> 
> Reported-by: Andrzej Pietrasiewicz <andrze...@samsung.com>
> Cc: Andrzej Pietrasiewicz <andrze...@samsung.com>
> Cc: Sebastian Andrzej Siewior <bige...@linutronix.de>
> Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org>
> ---
>  drivers/usb/gadget/legacy/tcm_usb_gadget.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c 
> b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
> index b764e91..54f036b 100644
> --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
> +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
> @@ -1425,11 +1425,14 @@ static struct se_portal_group *usbg_make_tpg(
>       return &tpg->se_tpg;
>  }
>  
> +static int tcm_usbg_drop_nexus(struct usbg_tpg *);
> +
>  static void usbg_drop_tpg(struct se_portal_group *se_tpg)
>  {
>       struct usbg_tpg *tpg = container_of(se_tpg,
>                               struct usbg_tpg, se_tpg);
>  
> +     tcm_usbg_drop_nexus(tpg);
>       core_tpg_deregister(se_tpg);
>       destroy_workqueue(tpg->workqueue);
>       kfree(tpg);
> @@ -1507,10 +1510,14 @@ static ssize_t tcm_usbg_tpg_store_enable(
>       if (op > 1)
>               return -EINVAL;
>  
> -     if (op && tpg->gadget_connect)
> +     if (op && tpg->gadget_connect) {
> +             ret = -EINVAL;
>               goto out;
> -     if (!op && !tpg->gadget_connect)
> +     }

minor nit which I'm okay letting it go:

add a blank line here.

Acked-by: Felipe Balbi <ba...@ti.com>

> +     if (!op && !tpg->gadget_connect) {
> +             ret = -EINVAL;
>               goto out;
> +     }
>  
>       if (op) {
>               ret = usbg_attach(tpg);
> @@ -1520,8 +1527,10 @@ static ssize_t tcm_usbg_tpg_store_enable(
>               usbg_detach(tpg);
>       }
>       tpg->gadget_connect = op;
> -out:
> +
>       return count;
> +out:
> +     return ret;
>  }
>  TF_TPG_BASE_ATTR(tcm_usbg, enable, S_IRUGO | S_IWUSR);
>  
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
balbi

Attachment: signature.asc
Description: PGP signature

Reply via email to