aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-30 05:22:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-10 13:04:16 -0400
commit6d4e751e108b3a2333412b603911f8243e60a86e (patch)
treecea367e60c9ffc0164da75721cddfd28ec0414d7 /drivers/tty/vt
parent2eeaf0bbca79412f15d00a08b930cbd9235fc3a2 (diff)
tty: consolemap.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: Jiri Slaby <jslaby@suse.cz> CC: Takashi Iwai <tiwai@suse.de> CC: Imre Deak <imre.deak@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/consolemap.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 59b25e039968..c8c91f0476a2 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -261,19 +261,22 @@ u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode)
261 int m; 261 int m;
262 if (glyph < 0 || glyph >= MAX_GLYPH) 262 if (glyph < 0 || glyph >= MAX_GLYPH)
263 return 0; 263 return 0;
264 else if (!(p = *conp->vc_uni_pagedir_loc)) 264 else {
265 return glyph; 265 p = *conp->vc_uni_pagedir_loc;
266 else if (use_unicode) { 266 if (!p)
267 if (!p->inverse_trans_unicode)
268 return glyph; 267 return glyph;
269 else 268 else if (use_unicode) {
270 return p->inverse_trans_unicode[glyph]; 269 if (!p->inverse_trans_unicode)
271 } else { 270 return glyph;
272 m = inv_translate[conp->vc_num]; 271 else
273 if (!p->inverse_translations[m]) 272 return p->inverse_trans_unicode[glyph];
274 return glyph; 273 } else {
275 else 274 m = inv_translate[conp->vc_num];
276 return p->inverse_translations[m][glyph]; 275 if (!p->inverse_translations[m])
276 return glyph;
277 else
278 return p->inverse_translations[m][glyph];
279 }
277 } 280 }
278} 281}
279EXPORT_SYMBOL_GPL(inverse_translate); 282EXPORT_SYMBOL_GPL(inverse_translate);
@@ -397,7 +400,8 @@ static void con_release_unimap(struct uni_pagedir *p)
397 400
398 if (p == dflt) dflt = NULL; 401 if (p == dflt) dflt = NULL;
399 for (i = 0; i < 32; i++) { 402 for (i = 0; i < 32; i++) {
400 if ((p1 = p->uni_pgdir[i]) != NULL) { 403 p1 = p->uni_pgdir[i];
404 if (p1 != NULL) {
401 for (j = 0; j < 32; j++) 405 for (j = 0; j < 32; j++)
402 kfree(p1[j]); 406 kfree(p1[j]);
403 kfree(p1); 407 kfree(p1);
@@ -473,14 +477,16 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos)
473 int i, n; 477 int i, n;
474 u16 **p1, *p2; 478 u16 **p1, *p2;
475 479
476 if (!(p1 = p->uni_pgdir[n = unicode >> 11])) { 480 p1 = p->uni_pgdir[n = unicode >> 11];
481 if (!p1) {
477 p1 = p->uni_pgdir[n] = kmalloc(32*sizeof(u16 *), GFP_KERNEL); 482 p1 = p->uni_pgdir[n] = kmalloc(32*sizeof(u16 *), GFP_KERNEL);
478 if (!p1) return -ENOMEM; 483 if (!p1) return -ENOMEM;
479 for (i = 0; i < 32; i++) 484 for (i = 0; i < 32; i++)
480 p1[i] = NULL; 485 p1[i] = NULL;
481 } 486 }
482 487
483 if (!(p2 = p1[n = (unicode >> 6) & 0x1f])) { 488 p2 = p1[n = (unicode >> 6) & 0x1f];
489 if (!p2) {
484 p2 = p1[n] = kmalloc(64*sizeof(u16), GFP_KERNEL); 490 p2 = p1[n] = kmalloc(64*sizeof(u16), GFP_KERNEL);
485 if (!p2) return -ENOMEM; 491 if (!p2) return -ENOMEM;
486 memset(p2, 0xff, 64*sizeof(u16)); /* No glyphs for the characters (yet) */ 492 memset(p2, 0xff, 64*sizeof(u16)); /* No glyphs for the characters (yet) */
@@ -569,10 +575,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
569 * entries from "p" (old) to "q" (new). 575 * entries from "p" (old) to "q" (new).
570 */ 576 */
571 l = 0; /* unicode value */ 577 l = 0; /* unicode value */
572 for (i = 0; i < 32; i++) 578 for (i = 0; i < 32; i++) {
573 if ((p1 = p->uni_pgdir[i])) 579 p1 = p->uni_pgdir[i];
574 for (j = 0; j < 32; j++) 580 if (p1)
575 if ((p2 = p1[j])) { 581 for (j = 0; j < 32; j++) {
582 p2 = p1[j];
583 if (p2) {
576 for (k = 0; k < 64; k++, l++) 584 for (k = 0; k < 64; k++, l++)
577 if (p2[k] != 0xffff) { 585 if (p2[k] != 0xffff) {
578 /* 586 /*
@@ -593,9 +601,11 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
593 /* Account for row of 64 empty entries */ 601 /* Account for row of 64 empty entries */
594 l += 64; 602 l += 64;
595 } 603 }
604 }
596 else 605 else
597 /* Account for empty table */ 606 /* Account for empty table */
598 l += 32 * 64; 607 l += 32 * 64;
608 }
599 609
600 /* 610 /*
601 * Finished copying font table, set vc_uni_pagedir to new table 611 * Finished copying font table, set vc_uni_pagedir to new table
@@ -735,10 +745,12 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct uni
735 ect = 0; 745 ect = 0;
736 if (*vc->vc_uni_pagedir_loc) { 746 if (*vc->vc_uni_pagedir_loc) {
737 p = *vc->vc_uni_pagedir_loc; 747 p = *vc->vc_uni_pagedir_loc;
738 for (i = 0; i < 32; i++) 748 for (i = 0; i < 32; i++) {
739 if ((p1 = p->uni_pgdir[i])) 749 p1 = p->uni_pgdir[i];
740 for (j = 0; j < 32; j++) 750 if (p1)
741 if ((p2 = *(p1++))) 751 for (j = 0; j < 32; j++) {
752 p2 = *(p1++);
753 if (p2)
742 for (k = 0; k < 64; k++) { 754 for (k = 0; k < 64; k++) {
743 if (*p2 < MAX_GLYPH && ect++ < ct) { 755 if (*p2 < MAX_GLYPH && ect++ < ct) {
744 __put_user((u_short)((i<<11)+(j<<6)+k), 756 __put_user((u_short)((i<<11)+(j<<6)+k),
@@ -749,6 +761,8 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct uni
749 } 761 }
750 p2++; 762 p2++;
751 } 763 }
764 }
765 }
752 } 766 }
753 __put_user(ect, uct); 767 __put_user(ect, uct);
754 console_unlock(); 768 console_unlock();