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.
This commit is contained in:
Marcelo Araujo 2014-10-28 03:42:09 +00:00
parent dbf11b2466
commit 3bde81092c

View File

@ -196,7 +196,8 @@ uart_parse_tag(const char **p)
int int
uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) 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; bus_addr_t addr = ~0U;
int error; 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 * which UART port is to be used as serial console or debug
* port (resp). * port (resp).
*/ */
if (devtype == UART_DEV_CONSOLE) switch (devtype) {
case UART_DEV_CONSOLE:
cp = kern_getenv("hw.uart.console"); cp = kern_getenv("hw.uart.console");
else if (devtype == UART_DEV_DBGPORT) break;
case UART_DEV_DBGPORT:
cp = kern_getenv("hw.uart.dbgport"); cp = kern_getenv("hw.uart.dbgport");
else break;
default:
cp = NULL; cp = NULL;
break;
}
if (cp == NULL) if (cp == NULL)
return (ENXIO); return (ENXIO);
@ -233,7 +240,7 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
/* Parse the attributes. */ /* Parse the attributes. */
spec = cp; spec = cp;
while (1) { for (;;) {
switch (uart_parse_tag(&spec)) { switch (uart_parse_tag(&spec)) {
case UART_TAG_BR: case UART_TAG_BR:
di->baudrate = uart_parse_long(&spec); 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); di->bas.rclk = uart_parse_long(&spec);
break; break;
default: default:
freeenv(__DECONST(char *, cp)); freeenv(cp);
return (EINVAL); return (EINVAL);
} }
if (*spec == '\0') if (*spec == '\0')
break; break;
if (*spec != ',') { if (*spec != ',') {
freeenv(__DECONST(char *, cp)); freeenv(cp);
return (EINVAL); return (EINVAL);
} }
spec++; spec++;
} }
freeenv(__DECONST(char *, cp)); freeenv(cp);
/* /*
* If we still have an invalid address, the specification must be * If we still have an invalid address, the specification must be