Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge Make error checking consistent, possibly fix...
details: https://anonhg.NetBSD.org/src/rev/f2486c08d203
branches: trunk
changeset: 762784:f2486c08d203
user: christos <christos%NetBSD.org@localhost>
date: Mon Feb 28 18:28:20 2011 +0000
description:
Make error checking consistent, possibly fixes PR/44652.
diffstat:
sys/dev/dkwedge/dk.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diffs (94 lines):
diff -r 8bd56e7422f4 -r f2486c08d203 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Mon Feb 28 17:19:43 2011 +0000
+++ b/sys/dev/dkwedge/dk.c Mon Feb 28 18:28:20 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.58 2010/12/23 14:22:03 mlelstv Exp $ */
+/* $NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.58 2010/12/23 14:22:03 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -993,7 +993,6 @@
if (sc == NULL)
return (ENODEV);
-
if (sc->sc_state != DKW_STATE_RUNNING)
return (ENXIO);
@@ -1073,6 +1072,11 @@
struct dkwedge_softc *sc = dkwedge_lookup(dev);
int error = 0;
+ if (sc == NULL)
+ return (ENODEV);
+ if (sc->sc_state != DKW_STATE_RUNNING)
+ return (ENXIO);
+
KASSERT(sc->sc_dk.dk_openmask != 0);
mutex_enter(&sc->sc_dk.dk_openlock);
@@ -1107,6 +1111,10 @@
uint64_t p_size, p_offset;
int s;
+ if (sc == NULL) {
+ bp->b_error = ENODEV;
+ goto done;
+ }
if (sc->sc_state != DKW_STATE_RUNNING) {
bp->b_error = ENXIO;
goto done;
@@ -1281,6 +1289,8 @@
{
struct dkwedge_softc *sc = dkwedge_lookup(dev);
+ if (sc == NULL)
+ return (ENODEV);
if (sc->sc_state != DKW_STATE_RUNNING)
return (ENXIO);
@@ -1297,6 +1307,8 @@
{
struct dkwedge_softc *sc = dkwedge_lookup(dev);
+ if (sc == NULL)
+ return (ENODEV);
if (sc->sc_state != DKW_STATE_RUNNING)
return (ENXIO);
@@ -1314,6 +1326,8 @@
struct dkwedge_softc *sc = dkwedge_lookup(dev);
int error = 0;
+ if (sc == NULL)
+ return (ENODEV);
if (sc->sc_state != DKW_STATE_RUNNING)
return (ENXIO);
@@ -1373,7 +1387,6 @@
if (sc == NULL)
return (-1);
-
if (sc->sc_state != DKW_STATE_RUNNING)
return (-1);
@@ -1409,8 +1422,7 @@
int rv = 0;
if (sc == NULL)
- return (ENXIO);
-
+ return (ENODEV);
if (sc->sc_state != DKW_STATE_RUNNING)
return (ENXIO);
Home |
Main Index |
Thread Index |
Old Index