From: DENX Support System <support@denx.de>
To: u-boot@lists.denx.de
Subject: [DNX#2006040142001347] [U-Boot-Users] [PATCH] Fixing 'pci' command output [...]
Date: Sat, 1 Apr 2006 02:00:06 +0200 [thread overview]
Message-ID: <1143849606.695691.095598712@castor.denx.de> (raw)
Hello list,
inside the automatic U-Boot patch tracking system a new ticket
[DNX#2006040142001347] was created:
<snip>
> hi!
>
> currently a series of 'pci_bus_to_hose() failed' messages are printed
> when
> pciinfo() is called with a invalid (out-of-bounds) bus number.
>
> this patch fixes the output of the 'pci' command by
> *) checking that the given bus number is actually a number
> *) checking that the given bus number is not out-of-bounds before doing
> a
> scan
> *) printing 'pci_bus_to_hose() failed' only when DEBUG is defined
>
>
> Signed-off-by: Horst Kronstorfer <hkronsto <at> frequentis.com>
>
> CHANGELOG
>
> * Fixing 'pci' command output:
> Patch by Horst Kronstorfer, 26 Jan 2006
>
> diff --git a/common/cmd_pci.c b/common/cmd_pci.c
> index 4508546..e0e166c 100644
> --- a/common/cmd_pci.c
> +++ b/common/cmd_pci.c
> @@ -71,6 +71,11 @@ void pciinfo(int BusNum, int ShortPCILis
> unsigned short VendorID;
> pci_dev_t dev;
>
> + if (pci_bus_to_hose(BusNum) == NULL) {
> + printf("Error: bus no. %d does not exist\n", BusNum);
> + return;
> + }
> +
> printf("Scanning PCI devices on bus %d\n", BusNum);
>
> if (ShortPCIListing) {
> @@ -511,9 +516,17 @@ int do_pci (cmd_tbl_t *cmdtp, int flag,
> if (argv[argc-1][0] == 'l') {
> value = 0;
> argc--;
> + } else if (argv[argc-1][0] == 's')
> + argc--;
> + if (argc > 1) {
> + char *endp;
> + bdf = simple_strtoul(argv[1], &endp,
> 16);
> + if (*endp != '\0') {
> + printf("Error: \`%s\' is not a
> valid
> "
> + "bus no.\n", argv[1]);
> + return 0;
> + }
> }
> - if (argc > 1)
> - bdf = simple_strtoul(argv[1], NULL, 16);
> }
> pciinfo(bdf, value);
> return 0;
> diff --git a/drivers/pci.c b/drivers/pci.c
> index 5360030..34b4055 100644
> --- a/drivers/pci.c
> +++ b/drivers/pci.c
> @@ -142,7 +142,7 @@ struct pci_controller *pci_bus_to_hose (
> if (bus >= hose->first_busno && bus <= hose->last_busno)
> return hose;
>
> - printf("pci_bus_to_hose() failed\n");
> + debug("pci_bus_to_hose() failed\n");
> return NULL;
> }
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
</snip>
Your U-Boot support team
reply other threads:[~2006-04-01 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1143849606.695691.095598712@castor.denx.de \
--to=support@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.