Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Add a kernel panic when we matched but can not h...
details: https://anonhg.NetBSD.org/src/rev/9af539c7c859
branches: trunk
changeset: 320081:9af539c7c859
user: martin <martin%NetBSD.org@localhost>
date: Fri Jun 22 15:48:57 2018 +0000
description:
Add a kernel panic when we matched but can not handle a string - better
die explicitly instead of crashing a few lines later with strange NULL
derefs.
diffstat:
sys/dev/i2c/dbcool.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r a59908584d9e -r 9af539c7c859 sys/dev/i2c/dbcool.c
--- a/sys/dev/i2c/dbcool.c Fri Jun 22 11:25:03 2018 +0000
+++ b/sys/dev/i2c/dbcool.c Fri Jun 22 15:48:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool.c,v 1.50 2018/06/18 17:07:07 thorpej Exp $ */
+/* $NetBSD: dbcool.c,v 1.51 2018/06/22 15:48:57 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.50 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.51 2018/06/22 15:48:57 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -779,9 +779,11 @@
sc->sc_dc.dc_chip = NULL;
sc->sc_dc.dc_readreg = dbcool_readreg;
sc->sc_dc.dc_writereg = dbcool_writereg;
- (void)dbcool_chip_ident(&sc->sc_dc);
sc->sc_dev = self;
+ if (dbcool_chip_ident(&sc->sc_dc) < 0 || sc->sc_dc.dc_chip == NULL)
+ panic("could not identify chip at addr %d", args->ia_addr);
+
aprint_naive("\n");
aprint_normal("\n");
Home |
Main Index |
Thread Index |
Old Index