Re: [PATCH v4 1/3] RAS: Introduce AMD Address Translation Library

From: Markus Elfring
Date: Wed Dec 20 2023 - 11:21:50 EST



> +++ b/drivers/ras/amd/atl/core.c
> @@ -0,0 +1,225 @@

> +unsigned long norm_to_sys_addr(u8 socket_id, u8 die_id, u8 coh_st_inst_id, unsigned long addr)
> +{

> + if (!late_hole_remove(&ctx) && add_base_and_hole(&ctx))
> + return -EINVAL;
> +
> + if (dehash_address(&ctx))
> + return -EINVAL;
> +
> + if (late_hole_remove(&ctx) && add_base_and_hole(&ctx))
> + return -EINVAL;

> + return ctx.ret_addr;
> +}


I wonder which condition checks should actually be used for such
a function implementation.

How do you think about to avoid also the specification of duplicate
return statements here?

Regards,
Markus