All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info()
@ 2023-03-21 21:43 Christophe JAILLET
  2023-03-21 21:43 ` [PATCH 2/2] usb: pci-quirks: Remove a useless initialization Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2023-03-21 21:43 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-usb

'info' is local to the function. There is no need to zeroing it within
a spin_lock section.

Move the memset() after spin_unlock_irqrestore().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/usb/host/pci-quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index ef08d68b9714..6b741327d2c4 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -218,9 +218,9 @@ static void usb_amd_find_chipset_info(void)
 		spin_unlock_irqrestore(&amd_lock, flags);
 		return;
 	}
-	memset(&info, 0, sizeof(info));
 	spin_unlock_irqrestore(&amd_lock, flags);
 
+	memset(&info, 0, sizeof(info));
 	if (!amd_chipset_sb_type_init(&info)) {
 		goto commit;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] usb: pci-quirks: Remove a useless initialization
  2023-03-21 21:43 [PATCH 1/2] usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info() Christophe JAILLET
@ 2023-03-21 21:43 ` Christophe JAILLET
  2023-03-23 16:32   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2023-03-21 21:43 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-usb

'info' is memset()'ed a few lines below and is not use in the between.

There is no need to initialize one of its field to false here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/usb/host/pci-quirks.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 6b741327d2c4..46f2412dcb40 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -208,7 +208,6 @@ static void usb_amd_find_chipset_info(void)
 {
 	unsigned long flags;
 	struct amd_chipset_info info;
-	info.need_pll_quirk = false;
 
 	spin_lock_irqsave(&amd_lock, flags);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] usb: pci-quirks: Remove a useless initialization
  2023-03-21 21:43 ` [PATCH 2/2] usb: pci-quirks: Remove a useless initialization Christophe JAILLET
@ 2023-03-23 16:32   ` Greg Kroah-Hartman
  2023-03-23 19:17     ` Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-23 16:32 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Mathias Nyman, linux-kernel, kernel-janitors, linux-usb

On Tue, Mar 21, 2023 at 10:43:10PM +0100, Christophe JAILLET wrote:
> 'info' is memset()'ed a few lines below and is not use in the between.
> 
> There is no need to initialize one of its field to false here.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/usb/host/pci-quirks.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index 6b741327d2c4..46f2412dcb40 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -208,7 +208,6 @@ static void usb_amd_find_chipset_info(void)
>  {
>  	unsigned long flags;
>  	struct amd_chipset_info info;
> -	info.need_pll_quirk = false;

Why not just change the line above it to:
	struct amd_chipset_info info = { };
and drop the call to memset entirely?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] usb: pci-quirks: Remove a useless initialization
  2023-03-23 16:32   ` Greg Kroah-Hartman
@ 2023-03-23 19:17     ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-03-23 19:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mathias Nyman, linux-kernel, kernel-janitors, linux-usb


Le 23/03/2023 à 17:32, Greg Kroah-Hartman a écrit :
> On Tue, Mar 21, 2023 at 10:43:10PM +0100, Christophe JAILLET wrote:
>> 'info' is memset()'ed a few lines below and is not use in the between.
>>
>> There is no need to initialize one of its field to false here.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/usb/host/pci-quirks.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
>> index 6b741327d2c4..46f2412dcb40 100644
>> --- a/drivers/usb/host/pci-quirks.c
>> +++ b/drivers/usb/host/pci-quirks.c
>> @@ -208,7 +208,6 @@ static void usb_amd_find_chipset_info(void)
>>   {
>>   	unsigned long flags;
>>   	struct amd_chipset_info info;
>> -	info.need_pll_quirk = false;
> Why not just change the line above it to:
> 	struct amd_chipset_info info = { };
> and drop the call to memset entirely?

I find an explicit memset() more readable, but it's mostly a matter of 
taste.

I'll send a v2.

CJ


> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-23 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 21:43 [PATCH 1/2] usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info() Christophe JAILLET
2023-03-21 21:43 ` [PATCH 2/2] usb: pci-quirks: Remove a useless initialization Christophe JAILLET
2023-03-23 16:32   ` Greg Kroah-Hartman
2023-03-23 19:17     ` Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.