Linux USB
 help / color / mirror / Atom feed
From: Zijun Hu <zijun_hu@icloud.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zijun Hu <quic_zijuhu@quicinc.com>
Subject: Re: [PATCH] usb: dwc3: Simplify memset struct array
Date: Fri, 11 Apr 2025 08:07:32 +0800	[thread overview]
Message-ID: <2d047411-bfe7-4a7d-a6cf-d2103d6e09a2@icloud.com> (raw)
In-Reply-To: <2025041024-napping-renewed-1b41@gregkh>

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) ?


      reply	other threads:[~2025-04-11  0:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d047411-bfe7-4a7d-a6cf-d2103d6e09a2@icloud.com \
    --to=zijun_hu@icloud.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_zijuhu@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox