Skip to contentSkip to conversation

usb: r8a66597: Fix initilization size of r8a66597 info, structure

PATCH New yasuhisa umano 2 participants 4 messages Apr 17, 2014 – Apr 18, 2014 USB

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 usb: r8a66597: Fix initilization size of r8a66597 info, structure

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

---
 drivers/usb/host/r8a66597-hcd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/r8a66597-hcd.c +0 -0
index c58d2a9..8e82212 100644
@@ -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);

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 usb: r8a66597: Fix initilization size of r8a66597 info, structure

Quoted 14 lines · yasuhisa umano

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

---
 drivers/usb/host/r8a66597-hcd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644

drivers/usb/host/r8a66597-hcd.c int usb_lowlevel_init(int index, enum usb_init_type · line 811

Quoted 6 lines
drivers/usb/host/r8a66597-hcd.c +1 -1
@@ -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

#2 lore raw

PATCH 2/2 usb: r8a66597: Fix initilization size of r8a66597 info, structure

Hi,
Thanks for your comment.

Quoted 19 lines · Marek Vasut
Quoted 18 lines · yasuhisa umano

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

---
  drivers/usb/host/r8a66597-hcd.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644

drivers/usb/host/r8a66597-hcd.c +0 -0
@@ -807,7 +807,7 @@ int usb_lowlevel_init(int index, enum usb_init_type
 init, void **controller)
 
  	R8A66597_DPRINT("%s\n", __func__);
 
Quoted 7 lines

drivers/usb/host/r8a66597-hcd.c int usb_lowlevel_init(int index, enum usb_init_type · line 811

Quoted 2 lines
drivers/usb/host/r8a66597-hcd.c +1 -1
-	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.

Quoted 4 lines

Best regards,
Marek Vasut

Best regards,
Yasuhisa

#3 lore raw

PATCH 2/2 usb: r8a66597: Fix initilization size of r8a66597 info, structure

Quoted 31 lines · Yasuhisa Umano

Hi,
Thanks for your comment.

Quoted 27 lines · Marek Vasut
Quoted 15 lines · yasuhisa umano

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

---

  drivers/usb/host/r8a66597-hcd.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/host/r8a66597-hcd.c index c58d2a9..8e82212 100644

drivers/usb/host/r8a66597-hcd.c int usb_lowlevel_init(int index, enum usb_init_type · line 811

Quoted 6 lines
drivers/usb/host/r8a66597-hcd.c +1 -1
@@ -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,

Quoted 5 lines
Quoted 2 lines

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