diff mbox series

[linux-next] octeontx2-af: Remove redundant assignment operations

Message ID 20211018091612.858462-1-luo.penghao@zte.com.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [linux-next] octeontx2-af: Remove redundant assignment operations | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 11 this patch: 11
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

CGEL Oct. 18, 2021, 9:16 a.m. UTC
From: penghao luo <luo.penghao@zte.com.cn>

the variable err will be reassigned on subsequent branches, and this
assignment does not perform related value operations.

clang_analyzer complains as follows:

drivers/net/ethernet/marvell/sky2.c:4988: warning:

Although the value stored to 'err' is used in the enclosing expression,
the value is never actually read from 'err'.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
---
 drivers/net/ethernet/marvell/sky2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman Oct. 20, 2021, 9:18 a.m. UTC | #1
On Mon, Oct 18, 2021 at 09:16:12AM +0000, luo penghao wrote:
> From: penghao luo <luo.penghao@zte.com.cn>

I think the correct patch-prefix for this would be:

[PATCH net-next] sky2:

> 
> the variable err will be reassigned on subsequent branches, and this
> assignment does not perform related value operations.
> 
> clang_analyzer complains as follows:
> 
> drivers/net/ethernet/marvell/sky2.c:4988: warning:
> 
> Although the value stored to 'err' is used in the enclosing expression,
> the value is never actually read from 'err'.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
> ---
>  drivers/net/ethernet/marvell/sky2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
> index 3cb9c12..6428ae5 100644
> --- a/drivers/net/ethernet/marvell/sky2.c
> +++ b/drivers/net/ethernet/marvell/sky2.c
> @@ -4907,7 +4907,7 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	pci_set_master(pdev);
>  
>  	if (sizeof(dma_addr_t) > sizeof(u32) &&
> -	    !(err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))) {
> +	    !(dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))) {

I think you can drop the parentheses around the call to dma_set_mask()

>  		using_dac = 1;
>  		err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
>  		if (err < 0) {
> -- 
> 2.15.2
> 
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 3cb9c12..6428ae5 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4907,7 +4907,7 @@  static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	pci_set_master(pdev);
 
 	if (sizeof(dma_addr_t) > sizeof(u32) &&
-	    !(err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))) {
+	    !(dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))) {
 		using_dac = 1;
 		err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
 		if (err < 0) {