2022-01-12 18:28:14

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 2/2] ACPI: CPPC: Drop redundant local variable from cpc_read()

From: Rafael J. Wysocki <[email protected]>

The ret_val local variable in cpc_read() is not necessary, so
eliminate it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/acpi/cppc_acpi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-pm/drivers/acpi/cppc_acpi.c
===================================================================
--- linux-pm.orig/drivers/acpi/cppc_acpi.c
+++ linux-pm/drivers/acpi/cppc_acpi.c
@@ -915,14 +915,13 @@ int __weak cpc_write_ffh(int cpunum, str

static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
{
- int ret_val = 0;
void __iomem *vaddr = NULL;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
struct cpc_reg *reg = &reg_res->cpc_entry.reg;

if (reg_res->type == ACPI_TYPE_INTEGER) {
*val = reg_res->cpc_entry.int_value;
- return ret_val;
+ return 0;
}

*val = 0;
@@ -968,10 +967,10 @@ static int cpc_read(int cpu, struct cpc_
default:
pr_debug("Error: Cannot read %u bit width from PCC for ss: %d\n",
reg->bit_width, pcc_ss_id);
- ret_val = -EFAULT;
+ return -EFAULT;
}

- return ret_val;
+ return 0;
}

static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)





2022-01-13 02:40:14

by Huang Rui

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ACPI: CPPC: Drop redundant local variable from cpc_read()

On Thu, Jan 13, 2022 at 02:27:22AM +0800, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> The ret_val local variable in cpc_read() is not necessary, so
> eliminate it.
>
> No functional impact.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>

Acked-by: Huang Rui <[email protected]>

> ---
> drivers/acpi/cppc_acpi.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> Index: linux-pm/drivers/acpi/cppc_acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/cppc_acpi.c
> +++ linux-pm/drivers/acpi/cppc_acpi.c
> @@ -915,14 +915,13 @@ int __weak cpc_write_ffh(int cpunum, str
>
> static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
> {
> - int ret_val = 0;
> void __iomem *vaddr = NULL;
> int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
> struct cpc_reg *reg = &reg_res->cpc_entry.reg;
>
> if (reg_res->type == ACPI_TYPE_INTEGER) {
> *val = reg_res->cpc_entry.int_value;
> - return ret_val;
> + return 0;
> }
>
> *val = 0;
> @@ -968,10 +967,10 @@ static int cpc_read(int cpu, struct cpc_
> default:
> pr_debug("Error: Cannot read %u bit width from PCC for ss: %d\n",
> reg->bit_width, pcc_ss_id);
> - ret_val = -EFAULT;
> + return -EFAULT;
> }
>
> - return ret_val;
> + return 0;
> }
>
> static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
>
>
>