summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraraujo <araujo@FreeBSD.org>2014-10-28 03:42:09 +0000
committeraraujo <araujo@FreeBSD.org>2014-10-28 03:42:09 +0000
commit57afd12669b7f2106854d7004a5b11abfc0a8e62 (patch)
treea9725eb46a88c5dd22e26270bf9e6822547255d4
parent0610f4828fa1441c483d02bc6547fdaf849eee9b (diff)
downloadFreeBSD-src-57afd12669b7f2106854d7004a5b11abfc0a8e62.zip
FreeBSD-src-57afd12669b7f2106854d7004a5b11abfc0a8e62.tar.gz
Drop __DECONST as well as few fixes of style(9).
Phabric: D1012 Suggested by: mjg, jhb Reviewed by: mjg, jhb Sponsored by: QNAP Systems Inc.
-rw-r--r--sys/dev/uart/uart_subr.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c
index 26a774c..7a5df38 100644
--- a/sys/dev/uart/uart_subr.c
+++ b/sys/dev/uart/uart_subr.c
@@ -196,7 +196,8 @@ out:
int
uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
{
- const char *cp, *spec;
+ const char *spec;
+ char *cp;
bus_addr_t addr = ~0U;
int error;
@@ -213,12 +214,18 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
* which UART port is to be used as serial console or debug
* port (resp).
*/
- if (devtype == UART_DEV_CONSOLE)
+ switch (devtype) {
+ case UART_DEV_CONSOLE:
cp = kern_getenv("hw.uart.console");
- else if (devtype == UART_DEV_DBGPORT)
+ break;
+ case UART_DEV_DBGPORT:
cp = kern_getenv("hw.uart.dbgport");
- else
+ break;
+ default:
cp = NULL;
+ break;
+ }
+
if (cp == NULL)
return (ENXIO);
@@ -233,7 +240,7 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
/* Parse the attributes. */
spec = cp;
- while (1) {
+ for (;;) {
switch (uart_parse_tag(&spec)) {
case UART_TAG_BR:
di->baudrate = uart_parse_long(&spec);
@@ -268,18 +275,18 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
di->bas.rclk = uart_parse_long(&spec);
break;
default:
- freeenv(__DECONST(char *, cp));
+ freeenv(cp);
return (EINVAL);
}
if (*spec == '\0')
break;
if (*spec != ',') {
- freeenv(__DECONST(char *, cp));
+ freeenv(cp);
return (EINVAL);
}
spec++;
}
- freeenv(__DECONST(char *, cp));
+ freeenv(cp);
/*
* If we still have an invalid address, the specification must be
OpenPOWER on IntegriCloud