public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found
Date: Wed, 4 Sep 2013 09:14:46 -0400	[thread overview]
Message-ID: <20130904131446.GA30199@bill-the-cat> (raw)
In-Reply-To: <1378296961-24667-1-git-send-email-hs@denx.de>

On Wed, Sep 04, 2013 at 02:16:01PM +0200, Heiko Schocher wrote:

> if phy_connect() did not find a phy, phydev is not initialized
> and following code in cpsw_phy_init() maybe crashes. Fix this.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> Cc: Joe Hershberger <joe.hershberger@gmail.com>
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Cc: Tom Rini <trini@ti.com>
> 
> ---
> Found on the dxr2 board with no phy connected to the board,
> U-Boot crashes with:
> 
> U-Boot 2013.07-12701-gea98378-dirty (Sep 04 2013 - 06:58:16)
> 
> I2C:   ready
> DRAM:  128 MiB
> Enable d-cache
> FactorySet is not right in eeprom.
> NAND:  256 MiB
> MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
> 8-bit BCH HW ECC selected
> Net:   Could not get PHY for cpsw: addr 0
> data abort
> 
>     MAYBE you should read doc/README.arm-unaligned-accesses
> 
> pc : [<87f80574>]          lr : [<87f80fcc>]
> sp : 86f5aee0  ip : 00000034     fp : 80100020
> r10: 00000014  r9 : 07e5d000     r8 : 86f5af30
> r7 : 86f5f750  r6 : 86f5f804     r5 : 86f5f708  r4 : 86f5f750
> r3 : 00000000  r2 : 00000000     r1 : 87fa4d08  r0 : 00000000
> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
> Resetting CPU ...
> 
> resetting ...
> ---
>  drivers/net/cpsw.c | 3 +++
>  1 Datei ge??ndert, 3 Zeilen hinzugef??gt(+)
> 
> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
> index 9bab71a..b18d528 100644
> --- a/drivers/net/cpsw.c
> +++ b/drivers/net/cpsw.c
> @@ -947,6 +947,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
>  			dev,
>  			slave->data->phy_if);
>  
> +	if (!phydev)
> +		return -1;
> +
>  	phydev->supported &= supported;
>  	phydev->advertising = phydev->supported;

This isn't really an unaligned access problem it's a NULL pointer
dereference, so I'll re-word the commit message when I grab this for
u-boot-ti soon.

-- 
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/20130904/ba721599/attachment.pgp>

  reply	other threads:[~2013-09-04 13:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 12:16 [U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found Heiko Schocher
2013-09-04 13:14 ` Tom Rini [this message]
2013-09-05  5:56   ` Heiko Schocher
2013-09-04 19:11 ` Joe Hershberger
2013-09-05  6:05 ` [U-Boot] [PATCH v2] net, phy, cpsw: fix NULL pointer deference Heiko Schocher
2013-09-05  8:27   ` Mugunthan V N
2013-09-05  9:40     ` Heiko Schocher
2013-09-05  9:50   ` [U-Boot] [PATCH v3] " Heiko Schocher
2013-09-05 10:04     ` Mugunthan V N

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=20130904131446.GA30199@bill-the-cat \
    --to=trini@ti.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