[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6fe62fbc-c666-8163-5cd2-6bac5447546f@amperemail.onmicrosoft.com>
Date: Mon, 19 Dec 2022 17:12:29 +0700
From: Chanh Nguyen <chanh@...eremail.onmicrosoft.com>
To: Alan Stern <stern@...land.harvard.edu>
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 14/12/2022 22:24, Alan Stern wrote:
> [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]
>
>
> 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.
>
Thanks Alan! I'll update that.
>
>>
>> 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