summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/pcfclock.c
diff options
context:
space:
mode:
authorbrueffer <brueffer@FreeBSD.org>2009-10-22 06:51:29 +0000
committerbrueffer <brueffer@FreeBSD.org>2009-10-22 06:51:29 +0000
commit0567fca14237a5e9677251587101c8729486038f (patch)
tree06591a3e67ce88987a42af8796cde64f6ccc600c /sys/dev/ppbus/pcfclock.c
parent245a0bbb51844df0e40b284c191c7ba500ad62ae (diff)
downloadFreeBSD-src-0567fca14237a5e9677251587101c8729486038f.zip
FreeBSD-src-0567fca14237a5e9677251587101c8729486038f.tar.gz
Check pointer for NULL before dereferencing it, not after.
PR: 138387, 138388 Submitted by: Patroklos Argyroudis <argp@census-labs.com> MFC after: 1 week
Diffstat (limited to 'sys/dev/ppbus/pcfclock.c')
-rw-r--r--sys/dev/ppbus/pcfclock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c
index e59a891..65612a2 100644
--- a/sys/dev/ppbus/pcfclock.c
+++ b/sys/dev/ppbus/pcfclock.c
@@ -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,
OpenPOWER on IntegriCloud