[PATCH v2 15/31] EDAC/amd64: Simplify function parameters

From: Yazen Ghannam
Date: Wed Jun 23 2021 - 15:21:14 EST


Use a single address parameter for input and result to reduce the number
of parameters.

Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---
Link:
https://lkml.kernel.org/r/20210507190140.18854-12-Yazen.Ghannam@xxxxxxx

v1->v2:
* Moved from arch/x86 to EDAC.

drivers/edac/amd64_edac.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 3f1ff5adce4a..496ca863f45a 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1371,14 +1371,14 @@ static int addr_over_limit(struct addr_ctx *ctx)
return 0;
}

-static int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr)
+static int umc_normaddr_to_sysaddr(u64 *addr, u16 nid, u8 umc)
{
struct addr_ctx ctx;

memset(&ctx, 0, sizeof(ctx));

/* We start from the normalized address */
- ctx.ret_addr = norm_addr;
+ ctx.ret_addr = *addr;

ctx.nid = nid;
ctx.inst_id = umc;
@@ -1407,7 +1407,7 @@ static int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr
if (addr_over_limit(&ctx))
return -EINVAL;

- *sys_addr = ctx.ret_addr;
+ *addr = ctx.ret_addr;
return 0;
}

@@ -3314,7 +3314,7 @@ static void decode_umc_error(int node_id, struct mce *m)
struct mem_ctl_info *mci;
struct amd64_pvt *pvt;
struct err_info err;
- u64 sys_addr;
+ u64 sys_addr = m->addr;

mci = edac_mc_find(node_id);
if (!mci)
@@ -3345,7 +3345,7 @@ static void decode_umc_error(int node_id, struct mce *m)

err.csrow = m->synd & 0x7;

- if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) {
+ if (umc_normaddr_to_sysaddr(&sys_addr, pvt->mc_node_id, err.channel)) {
err.err_code = ERR_NORM_ADDR;
goto log_error;
}
--
2.25.1