2020-02-29 00:13:07

by Colin King

[permalink] [raw]
Subject: [PATCH] ACPI: video: remove redundant assignments to variable result

From: Colin Ian King <[email protected]>

The variable result is being initialized with a value that is never
read and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/acpi/acpi_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 15c5b272e698..bc96457c9e25 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -943,7 +943,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
int i, max_level = 0;
unsigned long long level, level_old;
struct acpi_video_device_brightness *br = NULL;
- int result = -EINVAL;
+ int result;

result = acpi_video_get_levels(device->dev, &br, &max_level);
if (result)
--
2.25.0


2020-03-04 11:04:01

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] ACPI: video: remove redundant assignments to variable result

On Saturday, February 29, 2020 1:12:43 AM CET Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The variable result is being initialized with a value that is never
> read and it is being updated later with a new value. The initialization
> is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/acpi/acpi_video.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index 15c5b272e698..bc96457c9e25 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -943,7 +943,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
> int i, max_level = 0;
> unsigned long long level, level_old;
> struct acpi_video_device_brightness *br = NULL;
> - int result = -EINVAL;
> + int result;
>
> result = acpi_video_get_levels(device->dev, &br, &max_level);
> if (result)
>

Applied as 5.7 material, thanks!