Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/awin Return an error instead of KASSERT() we...



details:   https://anonhg.NetBSD.org/src/rev/58c7ac4fbcc9
branches:  trunk
changeset: 341198:58c7ac4fbcc9
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Oct 25 20:46:46 2015 +0000

description:
Return an error instead of KASSERT() we don't get the expected type for
a key.

diffstat:

 sys/arch/evbarm/awin/awin_sysconfig.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r d00e21ee7796 -r 58c7ac4fbcc9 sys/arch/evbarm/awin/awin_sysconfig.c
--- a/sys/arch/evbarm/awin/awin_sysconfig.c     Sun Oct 25 19:06:49 2015 +0000
+++ b/sys/arch/evbarm/awin/awin_sysconfig.c     Sun Oct 25 20:46:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_sysconfig.c,v 1.1 2014/10/22 00:24:52 jmcneill Exp $ */
+/* $NetBSD: awin_sysconfig.c,v 1.2 2015/10/25 20:46:46 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_allwinner.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_sysconfig.c,v 1.1 2014/10/22 00:24:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_sysconfig.c,v 1.2 2015/10/25 20:46:46 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -154,7 +154,8 @@
        if (awin_sysconfig_parse(key, subkey, &value) == false)
                return -1;
 
-       KASSERT(value.type == AWIN_SYSCONFIG_TYPE_SINGLE_WORD);
+       if (value.type != AWIN_SYSCONFIG_TYPE_SINGLE_WORD)
+               return -1;
 
        memcpy(&ret, &awin_sysconfig[value.offset << 2], sizeof(ret));
 
@@ -169,7 +170,8 @@
        if (awin_sysconfig_parse(key, subkey, &value) == false)
                return NULL;
 
-       KASSERT(value.type == AWIN_SYSCONFIG_TYPE_STRING);
+       if (value.type != AWIN_SYSCONFIG_TYPE_STRING)
+               return NULL;
 
        return &awin_sysconfig[value.offset << 2];
 }



Home | Main Index | Thread Index | Old Index