]> Pileus Git - ~andy/linux/blobdiff - drivers/char/hvsi.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[~andy/linux] / drivers / char / hvsi.c
index 2989056a9e39bb1766bd8707c9a155be84613a8e..d4b14ff1c4c1b1b8a707cebd84c8626f5bd08520 100644 (file)
@@ -194,10 +194,8 @@ static inline void print_state(struct hvsi_struct *hp)
                "HVSI_WAIT_FOR_MCTRL_RESPONSE",
                "HVSI_FSP_DIED",
        };
-       const char *name = state_names[hp->state];
-
-       if (hp->state > ARRAY_SIZE(state_names))
-               name = "UNKNOWN";
+       const char *name = (hp->state < ARRAY_SIZE(state_names))
+               ? state_names[hp->state] : "UNKNOWN";
 
        pr_debug("hvsi%i: state = %s\n", hp->index, name);
 #endif /* DEBUG */
@@ -1230,11 +1228,12 @@ static struct tty_driver *hvsi_console_device(struct console *console,
 
 static int __init hvsi_console_setup(struct console *console, char *options)
 {
-       struct hvsi_struct *hp = &hvsi_ports[console->index];
+       struct hvsi_struct *hp;
        int ret;
 
        if (console->index < 0 || console->index >= hvsi_count)
                return -1;
+       hp = &hvsi_ports[console->index];
 
        /* give the FSP a chance to change the baud rate when we re-open */
        hvsi_close_protocol(hp);