Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: toshiba_acpi: Fix the wrong variable assignment

The commit 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up
variable declaration") cleans up variable declaration in
video_proc_write(). Seems it does the variable assignment in the
wrong place, this results in dead code and changes the source code
logic. Fix it by doing the assignment at the beginning of the funciton.

Fixes: 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up variable declaration")
Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Link: https://lore.kernel.org/r/1606024177-16481-1-git-send-email-kaixuxia@tencent.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Kaixu Xia and committed by
Hans de Goede
2a72c46a 9e7a005a

+1 -2
+1 -2
drivers/platform/x86/toshiba_acpi.c
··· 1478 1478 struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); 1479 1479 char *buffer; 1480 1480 char *cmd; 1481 - int lcd_out, crt_out, tv_out; 1481 + int lcd_out = -1, crt_out = -1, tv_out = -1; 1482 1482 int remain = count; 1483 1483 int value; 1484 1484 int ret; ··· 1510 1510 1511 1511 kfree(cmd); 1512 1512 1513 - lcd_out = crt_out = tv_out = -1; 1514 1513 ret = get_video_status(dev, &video_out); 1515 1514 if (!ret) { 1516 1515 unsigned int new_video_out = video_out;