usb: dwc3: Simplify memset struct array
Subsystems (2)
PATCH 1/1 usb: dwc3: Simplify memset struct array
From: Zijun Hu <[email protected]>
For 'struct property_entry props[6]', Simplify its memset to 'memset(props, 0, sizeof(props))'.
--- drivers/usb/dwc3/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/host.c +1 -1
@@ -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,
Signature · 1 line
Zijun Hu <[email protected]>
Greg Kroah-Hartman
maintainerQuoted 15 lines · Zijun Hu
From: Zijun Hu <[email protected]>
For 'struct
property_entryprops[6]', Simplify its memset to 'memset(props, 0, sizeof(props))'.Signed-off-by Zijun Hu <[email protected]>--- drivers/usb/dwc3/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/dwc3/host.c +0
-0
drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 161
Quoted 5 lines
drivers/usb/dwc3/host.c +1
-1@@ -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
Quoted 11 lines · Greg Kroah-Hartman
drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 161
Quoted 10 lines
drivers/usb/dwc3/host.c +1
-1@@ -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) ?