* [PATCH] usb: dwc3: Simplify memset struct array
@ 2025-04-10 13:30 Zijun Hu
2025-04-10 17:02 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Zijun Hu @ 2025-04-10 13:30 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman
Cc: Zijun Hu, linux-usb, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
For 'struct property_entry props[6]', Simplify its memset to
'memset(props, 0, sizeof(props))'.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/usb/dwc3/host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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));
props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-sg-trb-cache-size-quirk");
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250410-simplify_memset-0ea6dc94a0c7
Best regards,
--
Zijun Hu <quic_zijuhu@quicinc.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: Simplify memset struct array
2025-04-10 13:30 [PATCH] usb: dwc3: Simplify memset struct array Zijun Hu
@ 2025-04-10 17:02 ` Greg Kroah-Hartman
2025-04-11 0:07 ` Zijun Hu
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-04-10 17:02 UTC (permalink / raw)
To: Zijun Hu; +Cc: Thinh Nguyen, linux-usb, linux-kernel, Zijun Hu
On Thu, Apr 10, 2025 at 09:30:00PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
>
> For 'struct property_entry props[6]', Simplify its memset to
> 'memset(props, 0, sizeof(props))'.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> drivers/usb/dwc3/host.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: Simplify memset struct array
2025-04-10 17:02 ` Greg Kroah-Hartman
@ 2025-04-11 0:07 ` Zijun Hu
0 siblings, 0 replies; 3+ messages in thread
From: Zijun Hu @ 2025-04-11 0:07 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Thinh Nguyen, linux-usb, linux-kernel, Zijun Hu
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) ?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-11 0:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 13:30 [PATCH] usb: dwc3: Simplify memset struct array Zijun Hu
2025-04-10 17:02 ` Greg Kroah-Hartman
2025-04-11 0:07 ` Zijun Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox