From owner-svn-src-all@FreeBSD.ORG Thu Nov 18 17:58:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A68871065672; Thu, 18 Nov 2010 17:58:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97F428FC15; Thu, 18 Nov 2010 17:58:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAIHwxKc040175; Thu, 18 Nov 2010 17:58:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAIHwxkS040173; Thu, 18 Nov 2010 17:58:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011181758.oAIHwxkS040173@svn.freebsd.org> From: Marius Strobl Date: Thu, 18 Nov 2010 17:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215459 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2010 17:58:59 -0000 Author: marius Date: Thu Nov 18 17:58:59 2010 New Revision: 215459 URL: http://svn.freebsd.org/changeset/base/215459 Log: Fix a bug introduced with r215298; when atphy_reset() is called from atphy_attach() the current media has not been set, yet, leading to a NULL-dereference in atphy_setmedia(). Submitted by: jkim (initial version) Modified: head/sys/dev/mii/atphy.c Modified: head/sys/dev/mii/atphy.c ============================================================================== --- head/sys/dev/mii/atphy.c Thu Nov 18 17:50:23 2010 (r215458) +++ head/sys/dev/mii/atphy.c Thu Nov 18 17:58:59 2010 (r215459) @@ -317,6 +317,7 @@ atphy_status(struct mii_softc *sc) static void atphy_reset(struct mii_softc *sc) { + struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; struct atphy_softc *asc; uint32_t reg; int i; @@ -339,7 +340,7 @@ atphy_reset(struct mii_softc *sc) PHY_WRITE(sc, ATPHY_SCR, reg); /* Workaround F1 bug to reset phy. */ - atphy_setmedia(sc, sc->mii_pdata->mii_media.ifm_cur->ifm_media); + atphy_setmedia(sc, ife == NULL ? IFM_AUTO : ife->ifm_media); for (i = 0; i < 1000; i++) { DELAY(1);