[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <693a7640-68fc-9f68-8290-3542a9f02fd7@canonical.com>
Date: Wed, 2 Oct 2019 14:40:31 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Jose Abreu <joabreu@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: stmmac: xgmac: add missing parentheses to fix
precendence error
On 02/10/2019 14:33, Dan Carpenter wrote:
> On Wed, Oct 02, 2019 at 12:08:49PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> The expression !(hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10 is always zero, so
>> the masking operation is incorrect. Fix this by adding the missing
>> parentheses to correctly bind the negate operator on the entire expression.
>>
>> Addresses-Coverity: ("Operands don't affect result")
>> Fixes: c2b69474d63b ("net: stmmac: xgmac: Correct RAVSEL field interpretation")
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
>> index 965cbe3e6f51..2e814aa64a5c 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
>> @@ -369,7 +369,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
>> dma_cap->eee = (hw_cap & XGMAC_HWFEAT_EEESEL) >> 13;
>> dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;
>> dma_cap->av = (hw_cap & XGMAC_HWFEAT_AVSEL) >> 11;
>> - dma_cap->av &= !(hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10;
>> + dma_cap->av &= !((hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10);
>
> There is no point to the shift at all.
I must admit I was so focused on figuring out the original intent of the
code I totally missed that optimization step. I'll send a V2.
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists