public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure
@ 2014-04-17  8:20 yasuhisa umano
  2014-04-17 14:09 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: yasuhisa umano @ 2014-04-17  8:20 UTC (permalink / raw)
  To: u-boot

Initialization of r8a66597 info structure is not enough.
Because initilization was used size of pointer.
This fixes that use size of r8a6659 info structure.

Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
---
 drivers/usb/host/r8a66597-hcd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index c58d2a9..8e82212 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -807,7 +807,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init,
void **controller)

 	R8A66597_DPRINT("%s\n", __func__);

-	memset(r8a66597, 0, sizeof(r8a66597));
+	memset(r8a66597, 0, sizeof(struct r8a66597));
 	r8a66597->reg = CONFIG_R8A66597_BASE_ADDR;

 	disable_controller(r8a66597);
-- 
1.7.9.5

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

* [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure
  2014-04-17  8:20 [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure yasuhisa umano
@ 2014-04-17 14:09 ` Marek Vasut
  2014-04-18  2:26   ` Yasuhisa Umano
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2014-04-17 14:09 UTC (permalink / raw)
  To: u-boot

On Thursday, April 17, 2014 at 10:20:29 AM, yasuhisa umano wrote:
> Initialization of r8a66597 info structure is not enough.
> Because initilization was used size of pointer.
> This fixes that use size of r8a6659 info structure.
> 
> Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
> ---
>  drivers/usb/host/r8a66597-hcd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/r8a66597-hcd.c
> b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644
> --- a/drivers/usb/host/r8a66597-hcd.c
> +++ b/drivers/usb/host/r8a66597-hcd.c
> @@ -807,7 +807,7 @@ int usb_lowlevel_init(int index, enum usb_init_type
> init, void **controller)
> 
>  	R8A66597_DPRINT("%s\n", __func__);
> 
> -	memset(r8a66597, 0, sizeof(r8a66597));
> +	memset(r8a66597, 0, sizeof(struct r8a66597));

Let's use sizeof(*r8a66597) instead . This is more scalable as you won't need to 
adjust this code when you change the data type of the *r8a66597 pointer,

I will adjust that and apply with sizeof(*r8a66597); , does that work for you?

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure
  2014-04-17 14:09 ` Marek Vasut
@ 2014-04-18  2:26   ` Yasuhisa Umano
  2014-04-18 13:57     ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Yasuhisa Umano @ 2014-04-18  2:26 UTC (permalink / raw)
  To: u-boot

Hi,
Thanks for your comment.

(2014/04/17 23:09), Marek Vasut wrote:
> On Thursday, April 17, 2014 at 10:20:29 AM, yasuhisa umano wrote:
>> Initialization of r8a66597 info structure is not enough.
>> Because initilization was used size of pointer.
>> This fixes that use size of r8a6659 info structure.
>>
>> Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
>> ---
>>   drivers/usb/host/r8a66597-hcd.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/r8a66597-hcd.c
>> b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644
>> --- a/drivers/usb/host/r8a66597-hcd.c
>> +++ b/drivers/usb/host/r8a66597-hcd.c
>> @@ -807,7 +807,7 @@ int usb_lowlevel_init(int index, enum usb_init_type
>> init, void **controller)
>>
>>   	R8A66597_DPRINT("%s\n", __func__);
>>
>> -	memset(r8a66597, 0, sizeof(r8a66597));
>> +	memset(r8a66597, 0, sizeof(struct r8a66597));
>
> Let's use sizeof(*r8a66597) instead . This is more scalable as you won't need to
> adjust this code when you change the data type of the *r8a66597 pointer,
>
> I will adjust that and apply with sizeof(*r8a66597); , does that work for you?

Indeed.
I will check your point and resend updated patch.

>
> Best regards,
> Marek Vasut
>

Best regards,
Yasuhisa

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

* [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure
  2014-04-18  2:26   ` Yasuhisa Umano
@ 2014-04-18 13:57     ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2014-04-18 13:57 UTC (permalink / raw)
  To: u-boot

On Friday, April 18, 2014 at 04:26:29 AM, Yasuhisa Umano wrote:
> Hi,
> Thanks for your comment.
> 
> (2014/04/17 23:09), Marek Vasut wrote:
> > On Thursday, April 17, 2014 at 10:20:29 AM, yasuhisa umano wrote:
> >> Initialization of r8a66597 info structure is not enough.
> >> Because initilization was used size of pointer.
> >> This fixes that use size of r8a6659 info structure.
> >> 
> >> Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
> >> ---
> >> 
> >>   drivers/usb/host/r8a66597-hcd.c |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/usb/host/r8a66597-hcd.c
> >> b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644
> >> --- a/drivers/usb/host/r8a66597-hcd.c
> >> +++ b/drivers/usb/host/r8a66597-hcd.c
> >> @@ -807,7 +807,7 @@ int usb_lowlevel_init(int index, enum usb_init_type
> >> init, void **controller)
> >> 
> >>   	R8A66597_DPRINT("%s\n", __func__);
> >> 
> >> -	memset(r8a66597, 0, sizeof(r8a66597));
> >> +	memset(r8a66597, 0, sizeof(struct r8a66597));
> > 
> > Let's use sizeof(*r8a66597) instead . This is more scalable as you won't
> > need to adjust this code when you change the data type of the *r8a66597
> > pointer,
> > 
> > I will adjust that and apply with sizeof(*r8a66597); , does that work for
> > you?
> 
> Indeed.
> I will check your point and resend updated patch.

I pushed the fixed version and it's in u-boot-usb/master . Base subsequent 
patches on that please .

Best regards,
Marek Vasut

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

end of thread, other threads:[~2014-04-18 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17  8:20 [U-Boot] [PATCH 2/2] usb: r8a66597: Fix initilization size of r8a66597 info, structure yasuhisa umano
2014-04-17 14:09 ` Marek Vasut
2014-04-18  2:26   ` Yasuhisa Umano
2014-04-18 13:57     ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox