Date: Mon, 10 Oct 2011 17:53:06 +0000 (UTC) From: Christian Brueffer <brueffer@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r226225 - stable/8/sys/dev/ppbus Message-ID: <201110101753.p9AHr6Sk073916@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brueffer Date: Mon Oct 10 17:53:06 2011 New Revision: 226225 URL: http://svn.freebsd.org/changeset/base/226225 Log: MFC: r198358 Check pointer for NULL before dereferencing it, not after. Modified: stable/8/sys/dev/ppbus/lpt.c stable/8/sys/dev/ppbus/pcfclock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ppbus/lpt.c ============================================================================== --- stable/8/sys/dev/ppbus/lpt.c Mon Oct 10 17:41:11 2011 (r226224) +++ stable/8/sys/dev/ppbus/lpt.c Mon Oct 10 17:53:06 2011 (r226225) @@ -486,12 +486,15 @@ lptopen(struct cdev *dev, int flags, int { int trys, err; struct lpt_data *sc = dev->si_drv1; - device_t lptdev = sc->sc_dev; - device_t ppbus = device_get_parent(lptdev); + device_t lptdev; + device_t ppbus; if (!sc) return (ENXIO); + lptdev = sc->sc_dev; + ppbus = device_get_parent(lptdev); + ppb_lock(ppbus); if (sc->sc_state) { lprintf(("%s: still open %x\n", device_get_nameunit(lptdev), Modified: stable/8/sys/dev/ppbus/pcfclock.c ============================================================================== --- stable/8/sys/dev/ppbus/pcfclock.c Mon Oct 10 17:41:11 2011 (r226224) +++ stable/8/sys/dev/ppbus/pcfclock.c Mon Oct 10 17:53:06 2011 (r226225) @@ -150,12 +150,14 @@ static int pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td) { struct pcfclock_data *sc = dev->si_drv1; - device_t pcfclockdev = sc->dev; - device_t ppbus = device_get_parent(pcfclockdev); + device_t pcfclockdev; + device_t ppbus; int res; if (!sc) return (ENXIO); + pcfclockdev = sc->dev; + ppbus = device_get_parent(pcfclockdev); ppb_lock(ppbus); res = ppb_request_bus(ppbus, pcfclockdev,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110101753.p9AHr6Sk073916>