[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2d047411-bfe7-4a7d-a6cf-d2103d6e09a2@icloud.com>
Date: Fri, 11 Apr 2025 08:07:32 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thinh Nguyen <Thinh.Nguyen@...opsys.com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH] usb: dwc3: Simplify memset struct array
On 2025/4/11 01:02, Greg Kroah-Hartman wrote:
>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
>> index b48e108fc8fe7343446946e7babf9ba3bc0d2dc3..5a2fe4c6b0e433c32945c136b8b35e1912e3acc8 100644
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -158,7 +158,7 @@ int dwc3_host_init(struct dwc3 *dwc)
>> goto err;
>> }
>>
>> - memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
>> + memset(props, 0, sizeof(props));
> What does this really help with? It feels like churn to me.
just code in an even more concise way.
for "struct property_entry props[6]", what is your preference to
memset it ?
A) memset(props, 0, sizeof(props));
B) memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
drivers/usb/* have 5 usages as B).
is it worthy of a patch to simplify them if you prefer A) ?
Powered by blists - more mailing lists