Module Name:    src
Committed By:   jmcneill
Date:           Wed Jan  2 19:32:41 UTC 2019

Modified Files:
        src/sys/arch/arm/sunxi: sunxi_thermal.c

Log Message:
Clocks and resets are not present on all SoCs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_thermal.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/arch/arm/sunxi/sunxi_thermal.c
diff -u src/sys/arch/arm/sunxi/sunxi_thermal.c:1.6 src/sys/arch/arm/sunxi/sunxi_thermal.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_thermal.c:1.6	Tue Aug 21 14:09:41 2018
+++ src/sys/arch/arm/sunxi/sunxi_thermal.c	Wed Jan  2 19:32:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $ */
+/* $NetBSD: sunxi_thermal.c,v 1.7 2019/01/02 19:32:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcne...@invisible.ca>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.7 2019/01/02 19:32:41 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -513,28 +513,28 @@ sunxi_thermal_init_clocks(struct sunxi_t
 	int error;
 
 	clk = fdtbus_clock_get(sc->phandle, "ahb");
-	if (clk == NULL)
-		return ENXIO;
-	error = clk_enable(clk);
-	if (error != 0)
-		return error;
+	if (clk) {
+		error = clk_enable(clk);
+		if (error != 0)
+			return error;
+	}
 
 	clk = fdtbus_clock_get(sc->phandle, "ths");
-	if (clk == NULL)
-		return ENXIO;
-	error = clk_set_rate(clk, sc->conf->clk_rate);
-	if (error != 0)
-		return error;
-	error = clk_enable(clk);
-	if (error != 0)
-		return error;
+	if (clk) {
+		error = clk_set_rate(clk, sc->conf->clk_rate);
+		if (error != 0)
+			return error;
+		error = clk_enable(clk);
+		if (error != 0)
+			return error;
+	}
 
 	rst = fdtbus_reset_get_index(sc->phandle, 0);
-	if (rst == NULL)
-		return ENXIO;
-	error = fdtbus_reset_deassert(rst);
-	if (error != 0)
-		return error;
+	if (rst) {
+		error = fdtbus_reset_deassert(rst);
+		if (error != 0)
+			return error;
+	}
 
 	return 0;
 }

Reply via email to