Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Bail out of axpreg_attach if axpreg_get_voltage ...



details:   https://anonhg.NetBSD.org/src/rev/45c955e52980
branches:  trunk
changeset: 379258:45c955e52980
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon May 24 05:58:42 2021 +0000

description:
Bail out of axpreg_attach if axpreg_get_voltage returns an error.

uvol isn't updated and shouldn't be used.

diffstat:

 sys/dev/i2c/axppmic.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r a53b9082d3ea -r 45c955e52980 sys/dev/i2c/axppmic.c
--- a/sys/dev/i2c/axppmic.c     Mon May 24 03:43:24 2021 +0000
+++ b/sys/dev/i2c/axppmic.c     Mon May 24 05:58:42 2021 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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) {



Home | Main Index | Thread Index | Old Index