public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: Fix *val uninitialized bug
@ 2007-08-17  3:43 Shinya Kuribayashi
  2007-08-18 19:39 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Shinya Kuribayashi @ 2007-08-17  3:43 UTC (permalink / raw)
  To: u-boot

From: Shinya Kuribayashi <shinya.kuribayashi@necel.com>

This patch has been sent on:
- 6 Jun 2007

Many users of PCI config read routines tend to ignore the function
ret value, and are only concerned about the contents of *val. Based
on this, pci_hose_read_config_{byte,word}_via_dword should initialize
the *val on dword read error.

Without this fix, for example, we'll go on scanning bus with vendor or
header_type uninitialized. This brings many unnecessary config trials.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>

---

 drivers/pci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/drivers/pci.c
===================================================================
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -81,8 +81,10 @@ int pci_hose_read_config_##size##_via_dw
 {									\
 	u32 val32;							\
 									\
-	if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0)\
+	if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0) {	\
+		*val = -1;						\
 		return -1;						\
+	}								\
 									\
 	*val = (val32 >> ((offset & (int)off_mask) * 8));		\
 									\

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

* [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: Fix *val uninitialized bug
  2007-08-17  3:43 [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: Fix *val uninitialized bug Shinya Kuribayashi
@ 2007-08-18 19:39 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2007-08-18 19:39 UTC (permalink / raw)
  To: u-boot

In message <46C51970.6000207@necel.com> you wrote:
> From: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
> 
> This patch has been sent on:
> - 6 Jun 2007
> 
> Many users of PCI config read routines tend to ignore the function
> ret value, and are only concerned about the contents of *val. Based
> on this, pci_hose_read_config_{byte,word}_via_dword should initialize
> the *val on dword read error.
> 
> Without this fix, for example, we'll go on scanning bus with vendor or
> header_type uninitialized. This brings many unnecessary config trials.
> 
> Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Unix is simple, but it takes a genius to understand the simplicity."
					             - Dennis Ritchie

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

end of thread, other threads:[~2007-08-18 19:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-17  3:43 [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: Fix *val uninitialized bug Shinya Kuribayashi
2007-08-18 19:39 ` Wolfgang Denk

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