Linux USB
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Chanh Nguyen <chanh@amperemail.onmicrosoft.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Chanh Nguyen <chanh@os.amperecomputing.com>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dan Vacura <w36195@motorola.com>,
	Jakob Koschel <jakobkoschel@gmail.com>,
	Vijayavardhan Vennapusa <vvreddy@codeaurora.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Open Source Submission <patches@amperecomputing.com>,
	Frank Li <Frank.Li@nxp.com>, Rondreis <linhaoguo86@gmail.com>
Subject: Re: [PATCH] USB: gadget: Add ID numbers to configfs-gadget driver names
Date: Wed, 14 Dec 2022 10:24:37 -0500	[thread overview]
Message-ID: <Y5nqtYa9yC8YY839@rowland.harvard.edu> (raw)
In-Reply-To: <6044a542-fbcd-0fe7-abd3-83f38b731ecc@amperemail.onmicrosoft.com>

On Wed, Dec 14, 2022 at 11:15:48AM +0700, Chanh Nguyen wrote:

> Thanks CJ for the review!
> 
> I've made some changes as below (in gadgets_make() to remove unnecessary
> variables) and now trying to test it as much as possible. Will re-post it as
> v2 if looks good soon.
> 
> static inline struct gadget_info *to_gadget_info(struct config_item *item)
> @@ -1623,13 +1629,25 @@ static struct config_group *gadgets_make(
> 
>      gi->composite.gadget_driver = configfs_driver_template;
> 
> +    gi->driver_id_number = ida_alloc(&driver_id_numbers, GFP_KERNEL);
> +    if (gi->driver_id_number < 0)
> +        goto err;
> +
> +    gi->composite.gadget_driver.driver.name =
> +                          kasprintf(GFP_KERNEL, "configfs-gadget.%d",
> +                                    gi->driver_id_number);
> +    if (!gi->composite.gadget_driver.driver.name)
> +        goto out_free_driver_id_number;
> +
>      gi->composite.gadget_driver.function = kstrdup(name, GFP_KERNEL);
>      gi->composite.name = gi->composite.gadget_driver.function;
> 
>      if (!gi->composite.gadget_driver.function)
> -        goto err;
> +        goto out_free_driver_id_number;

This should goto out_free_driver_name.

Alan Stern

> 
>      return &gi->group;
> +
> +out_free_driver_id_number:
> +    ida_free(&driver_id_numbers, gi->driver_id_number);
>  err:
>      kfree(gi);
>      return ERR_PTR(-ENOMEM);

  parent reply	other threads:[~2022-12-14 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  4:12 [PATCH] USB: gadget: Add ID numbers to configfs-gadget driver names Chanh Nguyen
2022-12-13  7:22 ` Christophe JAILLET
2022-12-14  4:15   ` Chanh Nguyen
2022-12-14  4:20     ` [EXT] " Frank Li
2022-12-15  9:08       ` Chanh Nguyen
2022-12-15 16:15         ` Frank Li
2022-12-14 15:24     ` Alan Stern [this message]
2022-12-19 10:12       ` Chanh Nguyen

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=Y5nqtYa9yC8YY839@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=Frank.Li@nxp.com \
    --cc=chanh@amperemail.onmicrosoft.com \
    --cc=chanh@os.amperecomputing.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakobkoschel@gmail.com \
    --cc=linhaoguo86@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=patches@amperecomputing.com \
    --cc=vvreddy@codeaurora.org \
    --cc=w36195@motorola.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