Module Name: src Committed By: skrll Date: Mon May 24 05:58:42 UTC 2021
Modified Files: src/sys/dev/i2c: axppmic.c Log Message: Bail out of axpreg_attach if axpreg_get_voltage returns an error. uvol isn't updated and shouldn't be used. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/i2c/axppmic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/i2c/axppmic.c diff -u src/sys/dev/i2c/axppmic.c:1.34 src/sys/dev/i2c/axppmic.c:1.35 --- src/sys/dev/i2c/axppmic.c:1.34 Sat Apr 24 23:36:54 2021 +++ src/sys/dev/i2c/axppmic.c Mon May 24 05:58:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: axppmic.c,v 1.34 2021/04/24 23:36:54 thorpej Exp $ */ +/* $NetBSD: axppmic.c,v 1.35 2021/05/24 05:58:42 skrll Exp $ */ /*- * Copyright (c) 2014-2018 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.34 2021/04/24 23:36:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.35 2021/05/24 05:58:42 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1161,7 +1161,10 @@ axpreg_attach(device_t parent, device_t else aprint_normal("\n"); - axpreg_get_voltage(self, &uvol); + int error = axpreg_get_voltage(self, &uvol); + if (error) + return; + if (of_getprop_uint32(phandle, "regulator-min-microvolt", &min_uvol) == 0 && of_getprop_uint32(phandle, "regulator-max-microvolt", &max_uvol) == 0) { if (uvol < min_uvol || uvol > max_uvol) {