Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Call pathbuf_destroy exactly once, never twice. PR 4...



details:   https://anonhg.NetBSD.org/src/rev/bb97117703a3
branches:  trunk
changeset: 759015:bb97117703a3
user:      dholland <dholland%NetBSD.org@localhost>
date:      Wed Nov 24 16:31:12 2010 +0000

description:
Call pathbuf_destroy exactly once, never twice. PR 44144

diffstat:

 sys/dev/firmload.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 193e3aedb80b -r bb97117703a3 sys/dev/firmload.c
--- a/sys/dev/firmload.c        Wed Nov 24 15:17:46 2010 +0000
+++ b/sys/dev/firmload.c        Wed Nov 24 16:31:12 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firmload.c,v 1.15 2010/11/19 06:44:39 dholland Exp $   */
+/*     $NetBSD: firmload.c,v 1.16 2010/11/24 16:31:12 dholland Exp $   */
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.15 2010/11/19 06:44:39 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.16 2010/11/24 16:31:12 dholland Exp $");
 
 /*
  * The firmload API provides an interface for device drivers to access
@@ -242,7 +242,6 @@
        fh = firmware_handle_alloc();
        KASSERT(fh != NULL);
 
-       pb = NULL;
        error = 0;
        for (path = firmware_path_first(drvname, imgname, pnbuf, &prefix);
             path != NULL;
@@ -254,14 +253,13 @@
                }
                NDINIT(&nd, LOOKUP, FOLLOW | NOCHROOT, pb);
                error = vn_open(&nd, FREAD, 0);
+               pathbuf_destroy(pb);
                if (error == ENOENT) {
-                       pathbuf_destroy(pb);
                        continue;
                }
                break;
        }
 
-       pathbuf_destroy(pb);
        PNBUF_PUT(pnbuf);
        if (error) {
                firmware_handle_free(fh);



Home | Main Index | Thread Index | Old Index