svn commit: r281073 - head/sys/dev/uart
Andrew Turner
andrew at FreeBSD.org
Sat Apr 4 09:21:58 UTC 2015
Author: andrew
Date: Sat Apr 4 09:21:56 2015
New Revision: 281073
URL: https://svnweb.freebsd.org/changeset/base/281073
Log:
Use OF_getencprop over OF_getprop and fdt32_to_cpu. The latter may give
us the wrong data in the failure case if shift was not zero.
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/dev/uart/uart_bus_fdt.c
head/sys/dev/uart/uart_cpu_fdt.c
Modified: head/sys/dev/uart/uart_bus_fdt.c
==============================================================================
--- head/sys/dev/uart/uart_bus_fdt.c Sat Apr 4 09:07:31 2015 (r281072)
+++ head/sys/dev/uart/uart_bus_fdt.c Sat Apr 4 09:21:56 2015 (r281073)
@@ -89,11 +89,9 @@ uart_fdt_get_clock(phandle_t node, pcell
static int
uart_fdt_get_shift(phandle_t node, pcell_t *cell)
{
- pcell_t shift;
- if ((OF_getprop(node, "reg-shift", &shift, sizeof(shift))) <= 0)
- shift = 0;
- *cell = fdt32_to_cpu(shift);
+ if ((OF_getencprop(node, "reg-shift", cell, sizeof(*cell))) <= 0)
+ *cell = 0;
return (0);
}
Modified: head/sys/dev/uart/uart_cpu_fdt.c
==============================================================================
--- head/sys/dev/uart/uart_cpu_fdt.c Sat Apr 4 09:07:31 2015 (r281072)
+++ head/sys/dev/uart/uart_cpu_fdt.c Sat Apr 4 09:21:56 2015 (r281073)
@@ -82,11 +82,9 @@ uart_fdt_get_clock(phandle_t node, pcell
static int
uart_fdt_get_shift(phandle_t node, pcell_t *cell)
{
- pcell_t shift;
- if ((OF_getprop(node, "reg-shift", &shift, sizeof(shift))) <= 0)
- shift = 0;
- *cell = fdt32_to_cpu(shift);
+ if ((OF_getencprop(node, "reg-shift", cell, sizeof(*cell))) <= 0)
+ *cell = 0;
return (0);
}
More information about the svn-src-all
mailing list