Skip to contentSkip to conversation

USB: get rid of warning when compile with debug enabled

RFC PATCH New Bo Shen 3 participants 12 messages Aug 25, 2014 – Aug 28, 2014

lore
Share & tools
lore

Bo Shen

author
#0 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

---

 include/usb/lin_gadget_compat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/usb/lin_gadget_compat.h +1 -1
index a25e9d9..fb525e7 100644
@@ -15,7 +15,7 @@
 /* common */
 #define spin_lock_init(...)
 #define spin_lock(...)
-#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0)
+#define spin_lock_irqsave(lock, flags) do { flags = 1; debug("%lu\n", flags); } while (0)
 #define spin_unlock(...)
 #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
 #define disable_irq(...)
Signature · 1 line
1.8.5.2
#1 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

So which file does this warning come from ?

Quoted 11 lines

---

 include/usb/lin_gadget_compat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/usb/lin_gadget_compat.h index a25e9d9..fb525e7 100644

include/usb/lin_gadget_compat.h line 21

Quoted 8 lines
include/usb/lin_gadget_compat.h +0 -1
@@ -15,7 +15,7 @@
 /* common */
 #define spin_lock_init(...)
 #define spin_lock(...)
-#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while
 (0) +#define spin_lock_irqsave(lock, flags) do { flags = 1; debug("%lu\n",
 flags); } while (0) #define spin_unlock(...)
 #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
 #define disable_irq(...)

Best regards,
Marek Vasut

author
#2 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

Quoted 5 lines

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Quoted 6 lines
Quoted 6 lines

---

  include/usb/lin_gadget_compat.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

include/usb/lin_gadget_compat.h line 21

Quoted 13 lines
(quoted diff) +0 -0

b/include/usb/lin_gadget_compat.h index a25e9d9..fb525e7 100644

include/usb/lin_gadget_compat.h +0 -1
@@ -15,7 +15,7 @@
  /* common */
  #define spin_lock_init(...)
  #define spin_lock(...)
-#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while
 (0) +#define spin_lock_irqsave(lock, flags) do { flags = 1; debug("%lu\n",
 flags); } while (0) #define spin_unlock(...)
  #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
  #define disable_irq(...)

Best regards,
Marek Vasut

Best Regards,
Bo Shen

#3 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 9 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Best regards,
Marek Vasut

author
#4 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Hi Marek,

Quoted 32 lines · Marek Vasut
Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 6 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

Quoted 6 lines
Quoted 3 lines

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Thanks for your opinion.

I will send out the patch as you suggested to fix this issue.

Quoted 3 lines

Best regards,
Marek Vasut

Best Regards,
Bo Shen

#5 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 39 lines · Bo Shen

Hi Marek,

Quoted 36 lines · Marek Vasut
Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 9 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Quoted 6 lines
Quoted 2 lines

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Thanks for your opinion.

I will send out the patch as you suggested to fix this issue.

Thanks!

Best regards,
Marek Vasut

#6 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 40 lines · Marek Vasut
Quoted 39 lines · Bo Shen

Hi Marek,

Quoted 36 lines · Marek Vasut
Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 9 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Thanks for your opinion.

I will send out the patch as you suggested to fix this issue.

Thanks!

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140827/bdfdbfdb/attachment.pgp>
#7 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 44 lines · Tom Rini
Quoted 43 lines · Marek Vasut
Quoted 42 lines · Bo Shen

Hi Marek,

Quoted 38 lines · Marek Vasut
Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 9 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Thanks for your opinion.

I will send out the patch as you suggested to fix this issue.

Thanks!

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Can you please point out the exact patches ? Also, this is USB stuff, how can this be affected by any MTD stuff (unless there is a problem with patch separation) ?

Best regards,
Marek Vasut

#8 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Quoted 49 lines · Marek Vasut
Quoted 48 lines · Tom Rini
Quoted 47 lines · Marek Vasut
Quoted 45 lines · Bo Shen

Hi Marek,

Quoted 32 lines · Marek Vasut
Quoted 16 lines · Bo Shen

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Bo Shen

When compile with debug information is enabled, if call spin_lock_irqsave, it will give following warning information. This patch is used to get rid of it.
--->8---
warning: 'flags' is used uninitialized in this function [-Wuninitialized] ---8<---

The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews.

Quoted 6 lines
Quoted 1 line

So which file does this warning come from ?

I enable debug information (In common.h, define the DEBUG).

It comes out from usb gadget driver, for example, atmel_usba_udc.c and also s3c_udc_otg.c and etc.

Then those need fixing. There is no problem with the macro.

Quoted 6 lines

I see the spin_lock_irqsave() function in <drivers/usb/musb-new/linux-compat.h> defined as:
--->8---
#define spin_lock_irqsave(lock, flags) do {} while (0) ---8<---

Quoted 6 lines
Quoted 3 lines

As in u-boot, there is no lock actually, so I think we can fix it as <drivers/usb/musb-new/linux-compat.h>, or use the patch as I suggest, or anything else, what about your opinion?

Fix all the offending drivers which pass uninited variable into macro which might use it. That's the fix.

Thanks for your opinion.

I will send out the patch as you suggested to fix this issue.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Thanks!

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Can you please point out the exact patches ? Also, this is USB stuff, how can this be affected by any MTD stuff (unless there is a problem with patch separation) ?

It's linux compat "fun", http://patchwork.ozlabs.org/patch/363333/

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140827/166a284b/attachment.pgp>
#9 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

On Wednesday, August 27, 2014 at 11:20:45 PM, Tom Rini wrote:
[...]

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Can you please point out the exact patches ? Also, this is USB stuff, how can this be affected by any MTD stuff (unless there is a problem with patch separation) ?

It's linux compat "fun", http://patchwork.ozlabs.org/patch/363333/

OK, please update this thread when you merge that patch . And Bo, can you please verify after that update if this issue was resolved please ?

Best regards,
Marek Vasut

author
#10 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

Hi Marek,

Quoted 5 lines · Marek Vasut

On Wednesday, August 27, 2014 at 11:20:45 PM, Tom Rini wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Can you please point out the exact patches ? Also, this is USB stuff, how can this be affected by any MTD stuff (unless there is a problem with patch separation) ?

It's linux compat "fun", http://patchwork.ozlabs.org/patch/363333/

OK, please update this thread when you merge that patch . And Bo, can you please verify after that update if this issue was resolved please ?

OK, after this patch is merged, I will check it.
Thanks.

Quoted 3 lines

Best regards,
Marek Vasut

Best Regards,
Bo Shen

#11 lore raw

RFC PATCH 1/1 USB: get rid of warning when compile with debug enabled

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

On Wednesday, August 27, 2014 at 11:20:45 PM, Tom Rini wrote:
[...]

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

This is about to be complicated / fixed by the NAND patches that I'm merging and pushing shortly, so hold on please!

Can you please point out the exact patches ? Also, this is USB stuff, how can this be affected by any MTD stuff (unless there is a problem with patch separation) ?

Quoted 5 lines
Quoted 1 line

It's linux compat "fun", http://patchwork.ozlabs.org/patch/363333/

OK, please update this thread when you merge that patch . And Bo, can you please verify after that update if this issue was resolved please ?

OK, Heiko's patch applied now.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140828/ff2998cd/attachment.pgp>