[PATCH] arch/powerpc: Remove unnecessary endian conversion code in XICS

Jordan Niethe jniethe5 at gmail.com
Thu Jul 6 17:50:57 AEST 2023



On 30/6/23 3:56 pm, Gautam Menghani wrote:
> Remove an unnecessary piece of code that does an endianness conversion but
> does not use the result. The following warning was reported by Clang's
> static analyzer:
> 
> arch/powerpc/sysdev/xics/ics-opal.c:114:2: warning: Value stored to
> 'server' is never read [deadcode.DeadStores]
>          server = be16_to_cpu(oserver);
> 
> As the result of endianness conversion is never used, delete the line
> and fix the warning.
> 
> Signed-off-by: Gautam Menghani <gautam at linux.ibm.com>

'server' was used as a parameter to opal_get_xive() in commit 
5c7c1e9444d8 ("powerpc/powernv: Add OPAL ICS backend") when it was 
introduced. 'server' was also used in an error message for the call to 
opal_get_xive().

'server' was always later set by a call to ics_opal_mangle_server() 
before being used.

Commit bf8e0f891a32 ("powerpc/powernv: Fix endian issues in OPAL ICS 
backend") used a new variable 'oserver' as the parameter to 
opal_get_xive() instead of 'server' for endian correctness. It also 
removed 'server' from the error message for the call to opal_get_xive().

It was commit bf8e0f891a32 that added the unnecessary conversion and 
never used the result.

Reviewed-by: Jordan Niethe <jniethe5 at gmail.com>


> ---
>   arch/powerpc/sysdev/xics/ics-opal.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
> index 6cfbb4fac7fb..5fe73dabab79 100644
> --- a/arch/powerpc/sysdev/xics/ics-opal.c
> +++ b/arch/powerpc/sysdev/xics/ics-opal.c
> @@ -111,7 +111,6 @@ static int ics_opal_set_affinity(struct irq_data *d,
>   		       __func__, d->irq, hw_irq, rc);
>   		return -1;
>   	}
> -	server = be16_to_cpu(oserver);
>   
>   	wanted_server = xics_get_irq_server(d->irq, cpumask, 1);
>   	if (wanted_server < 0) {
> 


More information about the Linuxppc-dev mailing list