public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fix lockup in mcfmii/mii_discover_phy() in case communication fails
Date: Sun, 04 Apr 2010 22:44:40 -0700	[thread overview]
Message-ID: <4BB978C8.1080705@gmail.com> (raw)
In-Reply-To: <1269969591-15664-1-git-send-email-w.wegner@astro-kom.de>

Hi Wolfgang,

On 3/30/2010 10:19 AM, Wolfgang Wegner wrote:
> Signed-off-by: Wolfgang Wegner<w.wegner@astro-kom.de>
> ---
>   drivers/net/mcfmii.c |    6 +++++-
>   1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
> index 4acc29e..83c0873 100644
> --- a/drivers/net/mcfmii.c
> +++ b/drivers/net/mcfmii.c
> @@ -185,7 +185,11 @@ int mii_discover_phy(struct eth_device *dev)
>   				printf("PHY @ 0x%x pass %d\n", phyno, pass);
>   #endif
>
> -				for (i = 0; i<  (sizeof(phyinfo) / sizeof(phy_info_t)); i++) {
> +				for (i = 0;
> +					(i<  (sizeof(phyinfo)
> +						/ sizeof(phy_info_t)))
> +					&&  (phyinfo[i].phyid != 0);
> +					i++) {
>   					if (phyinfo[i].phyid == phytype) {
>   #ifdef ET_DEBUG
>   						printf("phyid %x - %s\n",
>    
This is brutal.  Using 8-space tabs really does a good job of 
highlighting deep nesting of conditionals.  If you're unable to make the 
driver easier to read (and I understand if that's the case), my 
preference would be to keep the sizeof()s on one line and combine the 
second && term and the i++ on another.  This makes lines > 80 chars, but 
it was already that way.

regards,
Ben

  parent reply	other threads:[~2010-04-05  5:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 14:50 [U-Boot] several problems with ethernet on MCF5445x w.wegner at astro-kom.de
2010-03-23 15:11 ` John Schmoller
2010-03-23 15:40   ` w.wegner at astro-kom.de
2010-03-23 16:10     ` Liew Tsi Chung-R5AAHP
2010-03-26 13:13       ` w.wegner at astro-kom.de
2010-03-26 14:55         ` w.wegner at astro-kom.de
2010-03-26 15:08           ` w.wegner at astro-kom.de
2010-03-26 16:19             ` Wolfgang Wegner
2010-03-30 17:19               ` [U-Boot] [PATCH] fix lockup in mcfmii/mii_discover_phy() in case communication fails Wolfgang Wegner
2010-03-30 17:19                 ` [U-Boot] [PATCH] add CONFIG_SYS_FEC_NO_SHARED_PHY for MCF5445x Wolfgang Wegner
2010-03-30 17:19                   ` [U-Boot] [PATCH] add CONFIG_SYS_FEC_FULL_MII " Wolfgang Wegner
2010-03-30 17:24                   ` [U-Boot] [PATCH] add CONFIG_SYS_FEC_NO_SHARED_PHY " Liew Tsi Chung-R5AAHP
2010-04-05  5:44                 ` Ben Warren [this message]
2010-04-06  8:38                   ` [U-Boot] [PATCH] fix lockup in mcfmii/mii_discover_phy() in case communication fails w.wegner at astro-kom.de
2010-04-06  9:13                     ` [U-Boot] [PATCH v2 RFC] " Wolfgang Wegner
2010-04-06 17:10                       ` Ben Warren
2010-04-06  9:15                   ` [U-Boot] [PATCH] " w.wegner at astro-kom.de

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=4BB978C8.1080705@gmail.com \
    --to=biggerbadderben@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox