Commit b87f5671 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: sisusb_con.c: move assignment out of if () block

We should not be doing assignments within an if () block
so fix up the code to not do this.

change was created using Coccinelle.

CC: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
parent 187859f9
...@@ -169,7 +169,8 @@ sisusb_get_sisusb_lock_and_check(unsigned short console) ...@@ -169,7 +169,8 @@ sisusb_get_sisusb_lock_and_check(unsigned short console)
if (in_atomic()) if (in_atomic())
return NULL; return NULL;
if (!(sisusb = sisusb_get_sisusb(console))) sisusb = sisusb_get_sisusb(console);
if (!sisusb)
return NULL; return NULL;
mutex_lock(&sisusb->lock); mutex_lock(&sisusb->lock);
...@@ -214,7 +215,8 @@ sisusbcon_init(struct vc_data *c, int init) ...@@ -214,7 +215,8 @@ sisusbcon_init(struct vc_data *c, int init)
* are set up/restored. * are set up/restored.
*/ */
if (!(sisusb = sisusb_get_sisusb(c->vc_num))) sisusb = sisusb_get_sisusb(c->vc_num);
if (!sisusb)
return; return;
mutex_lock(&sisusb->lock); mutex_lock(&sisusb->lock);
...@@ -277,7 +279,8 @@ sisusbcon_deinit(struct vc_data *c) ...@@ -277,7 +279,8 @@ sisusbcon_deinit(struct vc_data *c)
* and others, ie not under our control. * and others, ie not under our control.
*/ */
if (!(sisusb = sisusb_get_sisusb(c->vc_num))) sisusb = sisusb_get_sisusb(c->vc_num);
if (!sisusb)
return; return;
mutex_lock(&sisusb->lock); mutex_lock(&sisusb->lock);
...@@ -369,7 +372,8 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x) ...@@ -369,7 +372,8 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x)
struct sisusb_usb_data *sisusb; struct sisusb_usb_data *sisusb;
ssize_t written; ssize_t written;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -395,7 +399,8 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s, ...@@ -395,7 +399,8 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
u16 *dest; u16 *dest;
int i; int i;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -433,7 +438,8 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int height, int width) ...@@ -433,7 +438,8 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int height, int width)
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
return; return;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -486,7 +492,8 @@ sisusbcon_bmove(struct vc_data *c, int sy, int sx, ...@@ -486,7 +492,8 @@ sisusbcon_bmove(struct vc_data *c, int sy, int sx,
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
return; return;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -520,7 +527,8 @@ sisusbcon_switch(struct vc_data *c) ...@@ -520,7 +527,8 @@ sisusbcon_switch(struct vc_data *c)
* Returnvalue != 0 naturally means the opposite. * Returnvalue != 0 naturally means the opposite.
*/ */
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return 0; return 0;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -569,7 +577,8 @@ sisusbcon_save_screen(struct vc_data *c) ...@@ -569,7 +577,8 @@ sisusbcon_save_screen(struct vc_data *c)
* buffer. * buffer.
*/ */
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -602,7 +611,8 @@ sisusbcon_set_palette(struct vc_data *c, unsigned char *table) ...@@ -602,7 +611,8 @@ sisusbcon_set_palette(struct vc_data *c, unsigned char *table)
if (!CON_IS_VISIBLE(c)) if (!CON_IS_VISIBLE(c))
return -EINVAL; return -EINVAL;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return -EINVAL; return -EINVAL;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -637,7 +647,8 @@ sisusbcon_blank(struct vc_data *c, int blank, int mode_switch) ...@@ -637,7 +647,8 @@ sisusbcon_blank(struct vc_data *c, int blank, int mode_switch)
ssize_t written; ssize_t written;
int ret = 0; int ret = 0;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return 0; return 0;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -721,7 +732,8 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines) ...@@ -721,7 +732,8 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
/* The return value does not seem to be used */ /* The return value does not seem to be used */
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return 0; return 0;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -779,7 +791,8 @@ sisusbcon_cursor(struct vc_data *c, int mode) ...@@ -779,7 +791,8 @@ sisusbcon_cursor(struct vc_data *c, int mode)
struct sisusb_usb_data *sisusb; struct sisusb_usb_data *sisusb;
int from, to, baseline; int from, to, baseline;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return; return;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -906,7 +919,8 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines) ...@@ -906,7 +919,8 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
if (!lines) if (!lines)
return 1; return 1;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return 0; return 0;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -1018,7 +1032,8 @@ sisusbcon_set_origin(struct vc_data *c) ...@@ -1018,7 +1032,8 @@ sisusbcon_set_origin(struct vc_data *c)
* screenbuffer as the origin. * screenbuffer as the origin.
*/ */
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return 0; return 0;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -1047,7 +1062,8 @@ sisusbcon_resize(struct vc_data *c, unsigned int newcols, unsigned int newrows, ...@@ -1047,7 +1062,8 @@ sisusbcon_resize(struct vc_data *c, unsigned int newcols, unsigned int newrows,
struct sisusb_usb_data *sisusb; struct sisusb_usb_data *sisusb;
int fh; int fh;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return -ENODEV; return -ENODEV;
fh = sisusb->current_font_height; fh = sisusb->current_font_height;
...@@ -1286,7 +1302,8 @@ sisusbcon_font_set(struct vc_data *c, struct console_font *font, ...@@ -1286,7 +1302,8 @@ sisusbcon_font_set(struct vc_data *c, struct console_font *font,
if (font->width != 8 || (charcount != 256 && charcount != 512)) if (font->width != 8 || (charcount != 256 && charcount != 512))
return -EINVAL; return -EINVAL;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return -ENODEV; return -ENODEV;
/* sisusb->lock is down */ /* sisusb->lock is down */
...@@ -1326,7 +1343,8 @@ sisusbcon_font_get(struct vc_data *c, struct console_font *font) ...@@ -1326,7 +1343,8 @@ sisusbcon_font_get(struct vc_data *c, struct console_font *font)
{ {
struct sisusb_usb_data *sisusb; struct sisusb_usb_data *sisusb;
if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return -ENODEV; return -ENODEV;
/* sisusb->lock is down */ /* sisusb->lock is down */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment