Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dkwedge dk(4): dkdump: Simplify. No functional chan...



details:   https://anonhg.NetBSD.org/src/rev/700a19757ae6
branches:  trunk
changeset: 374393:700a19757ae6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Apr 21 18:45:13 2023 +0000

description:
dk(4): dkdump: Simplify.  No functional change intended.

diffstat:

 sys/dev/dkwedge/dk.c |  25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diffs (63 lines):

diff -r bef443bffa87 -r 700a19757ae6 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Fri Apr 21 18:44:58 2023 +0000
+++ b/sys/dev/dkwedge/dk.c      Fri Apr 21 18:45:13 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.146 2023/04/21 18:44:58 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.147 2023/04/21 18:45:13 riastradh 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.146 2023/04/21 18:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.147 2023/04/21 18:45:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1834,7 +1834,6 @@ dkdump(dev_t dev, daddr_t blkno, void *v
        struct dkwedge_softc *sc = dkwedge_lookup(dev);
        const struct bdevsw *bdev;
        uint64_t p_size, p_offset;
-       int rv = 0;
 
        if (sc == NULL)
                return ENXIO;
@@ -1845,14 +1844,10 @@ dkdump(dev_t dev, daddr_t blkno, void *v
 
        if (strcmp(sc->sc_ptype, DKW_PTYPE_SWAP) != 0 &&
            strcmp(sc->sc_ptype, DKW_PTYPE_RAID) != 0 &&
-           strcmp(sc->sc_ptype, DKW_PTYPE_CGD) != 0) {
-               rv = ENXIO;
-               goto out;
-       }
-       if (size % DEV_BSIZE != 0) {
-               rv = EINVAL;
-               goto out;
-       }
+           strcmp(sc->sc_ptype, DKW_PTYPE_CGD) != 0)
+               return ENXIO;
+       if (size % DEV_BSIZE != 0)
+               return EINVAL;
 
        p_offset = sc->sc_offset << sc->sc_parent->dk_blkshift;
        p_size = dkwedge_size(sc) << sc->sc_parent->dk_blkshift;
@@ -1861,15 +1856,11 @@ dkdump(dev_t dev, daddr_t blkno, void *v
                printf("%s: blkno (%" PRIu64 ") + size / DEV_BSIZE (%zu) > "
                    "p_size (%" PRIu64 ")\n", __func__, blkno,
                    size/DEV_BSIZE, p_size);
-               rv = EINVAL;
-               goto out;
+               return EINVAL;
        }
 
        bdev = bdevsw_lookup(sc->sc_pdev);
-       rv = (*bdev->d_dump)(sc->sc_pdev, blkno + p_offset, va, size);
-
-out:
-       return rv;
+       return (*bdev->d_dump)(sc->sc_pdev, blkno + p_offset, va, size);
 }
 
 /*



Home | Main Index | Thread Index | Old Index