[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5nqtYa9yC8YY839@rowland.harvard.edu>
Date: Wed, 14 Dec 2022 10:24:37 -0500
From: Alan Stern <stern@...land.harvard.edu>
To: Chanh Nguyen <chanh@...eremail.onmicrosoft.com>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Chanh Nguyen <chanh@...amperecomputing.com>,
OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Vacura <w36195@...orola.com>,
Jakob Koschel <jakobkoschel@...il.com>,
Vijayavardhan Vennapusa <vvreddy@...eaurora.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Open Source Submission <patches@...erecomputing.com>,
Frank Li <Frank.Li@....com>, Rondreis <linhaoguo86@...il.com>
Subject: Re: [PATCH] USB: gadget: Add ID numbers to configfs-gadget driver
names
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);
Powered by blists - more mailing lists