diff mbox series

[for-6.1?,v2,7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write

Message ID 20210725122416.1391332-8-richard.henderson@linaro.org
State New
Headers show
Series Fixes for clang-13 | expand

Commit Message

Richard Henderson July 25, 2021, 12:24 p.m. UTC
From clang-13:
hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
    [-Werror,-Wunused-but-set-variable]

It's pretty clear that we meant to write back 'v' after
all that computation and not 'val'.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/pci-host/pnv_phb4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé July 25, 2021, 9:27 p.m. UTC | #1
+Cédric/Benjamin

On 7/25/21 2:24 PM, Richard Henderson wrote:
> From clang-13:
> hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
>     [-Werror,-Wunused-but-set-variable]
> 
> It's pretty clear that we meant to write back 'v' after
> all that computation and not 'val'.
> 

Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")

> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  hw/pci-host/pnv_phb4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 54f57c660a..5c375a9f28 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
>              v &= 0xffffffffffff0000ull;
>              v |= 0x000000000000cfffull & val;
>          }
> -        *tptr = val;
> +        *tptr = v;
>          break;
>      }
>      case IODA3_TBL_MBT:
>
Benjamin Herrenschmidt July 26, 2021, 4:58 a.m. UTC | #2
On Sun, 2021-07-25 at 23:27 +0200, Philippe Mathieu-Daudé wrote:
> +Cédric/Benjamin
> 
> On 7/25/21 2:24 PM, Richard Henderson wrote:
> > From clang-13:
> > hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used
> > \
> >     [-Werror,-Wunused-but-set-variable]
> > 
> > It's pretty clear that we meant to write back 'v' after
> > all that computation and not 'val'.
> > 
> 
> Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host
> bridge")

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> > Acked-by: David Gibson <david@gibson.dropbear.id.au>
> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> > ---
> >  hw/pci-host/pnv_phb4.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> > index 54f57c660a..5c375a9f28 100644
> > --- a/hw/pci-host/pnv_phb4.c
> > +++ b/hw/pci-host/pnv_phb4.c
> > @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb,
> > uint64_t val)
> >              v &= 0xffffffffffff0000ull;
> >              v |= 0x000000000000cfffull & val;
> >          }
> > -        *tptr = val;
> > +        *tptr = v;
> >          break;
> >      }
> >      case IODA3_TBL_MBT:
> >
Cédric Le Goater July 26, 2021, 6:58 a.m. UTC | #3
On 7/25/21 11:27 PM, Philippe Mathieu-Daudé wrote:
> +Cédric/Benjamin
> 
> On 7/25/21 2:24 PM, Richard Henderson wrote:
>> From clang-13:
>> hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
>>     [-Werror,-Wunused-but-set-variable]
>>
>> It's pretty clear that we meant to write back 'v' after
>> all that computation and not 'val'.
>>
> 
> Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")

I went through the code and the PHB4 specs and I guess we didn't 
see any issues before because the written data is properly formatted
in OPAL.

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> 
>> Acked-by: David Gibson <david@gibson.dropbear.id.au>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>  hw/pci-host/pnv_phb4.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
>> index 54f57c660a..5c375a9f28 100644
>> --- a/hw/pci-host/pnv_phb4.c
>> +++ b/hw/pci-host/pnv_phb4.c
>> @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
>>              v &= 0xffffffffffff0000ull;
>>              v |= 0x000000000000cfffull & val;
>>          }
>> -        *tptr = val;
>> +        *tptr = v;
>>          break;
>>      }
>>      case IODA3_TBL_MBT:
>>
>
diff mbox series

Patch

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 54f57c660a..5c375a9f28 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -392,7 +392,7 @@  static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
             v &= 0xffffffffffff0000ull;
             v |= 0x000000000000cfffull & val;
         }
-        *tptr = val;
+        *tptr = v;
         break;
     }
     case IODA3_TBL_MBT: