summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaixu Xia <kaixuxia@tencent.com>2020-11-22 13:49:37 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-02 08:48:12 +0100
commite41d7a7dc67b876a000495498593f7833d88b0aa (patch)
tree8e50cff2e3e10b9a4c92b98b34800945fb85b222
parent0b50485e5d8b7a847a3a041b76f52ff48f1c3f65 (diff)
downloadlinux-stable-e41d7a7dc67b876a000495498593f7833d88b0aa.tar.gz
linux-stable-e41d7a7dc67b876a000495498593f7833d88b0aa.tar.bz2
linux-stable-e41d7a7dc67b876a000495498593f7833d88b0aa.zip
platform/x86: toshiba_acpi: Fix the wrong variable assignment
[ Upstream commit 2a72c46ac4d665614faa25e267c3fb27fb729ed7 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/platform/x86/toshiba_acpi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index e366977bda41..8c3e9bac4754 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1497,7 +1497,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file));
char *buffer;
char *cmd;
- int lcd_out, crt_out, tv_out;
+ int lcd_out = -1, crt_out = -1, tv_out = -1;
int remain = count;
int value;
int ret;
@@ -1529,7 +1529,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
kfree(cmd);
- lcd_out = crt_out = tv_out = -1;
ret = get_video_status(dev, &video_out);
if (!ret) {
unsigned int new_video_out = video_out;