All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: toshiba_acpi: Fix the wrong variable assignment
@ 2020-11-22  5:49 xiakaixu1987
  2020-11-24 12:07 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: xiakaixu1987 @ 2020-11-22  5:49 UTC (permalink / raw)
  To: coproscefalo, hdegoede, mgross
  Cc: platform-driver-x86, linux-kernel, Kaixu Xia

From: Kaixu Xia <kaixuxia@tencent.com>

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>
---
 drivers/platform/x86/toshiba_acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index e557d757c647..fa7232ad8c39 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1478,7 +1478,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;
@@ -1510,7 +1510,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;
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: toshiba_acpi: Fix the wrong variable assignment
  2020-11-22  5:49 [PATCH] platform/x86: toshiba_acpi: Fix the wrong variable assignment xiakaixu1987
@ 2020-11-24 12:07 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2020-11-24 12:07 UTC (permalink / raw)
  To: xiakaixu1987, coproscefalo, mgross
  Cc: platform-driver-x86, linux-kernel, Kaixu Xia

Hi,

On 11/22/20 6:49 AM, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> 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>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans

> ---
>  drivers/platform/x86/toshiba_acpi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index e557d757c647..fa7232ad8c39 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -1478,7 +1478,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;
> @@ -1510,7 +1510,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;
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-24 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22  5:49 [PATCH] platform/x86: toshiba_acpi: Fix the wrong variable assignment xiakaixu1987
2020-11-24 12:07 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.