Skip to contentSkip to conversation

pata_atiixp: Remove unnecessary parentheses

PATCH In review Nathan Chancellor 3 participants 3 messages Sep 11, 2018 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_atiixp: Remove unnecessary parentheses

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/ata/pata_atiixp.c:282:19: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
            ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/ata/pata_atiixp.c:282:19: note: remove extraneous parentheses around the comparison to silence this warning
if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
~ ^ ~
drivers/ata/pata_atiixp.c:282:19: note: use '=' to turn this equality comparison into an assignment

        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
                         ^~
                         =

1 warning generated.

---
 drivers/ata/pata_atiixp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_atiixp.c +1 -1
index 4d49fd3c927b..843bb200a1ee 100644
@@ -279,7 +279,7 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	const struct ata_port_info *ppi[] = { &info, &info };
 
 	/* SB600 doesn't have secondary port wired */
-	if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
+	if (pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE)
 		ppi[1] = &ata_dummy_port_info;
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Nathan Chancellor

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/ata/pata_atiixp.c:282:19: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
            ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/ata/pata_atiixp.c:282:19: note: remove extraneous parentheses around the comparison to silence this warning
if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
~ ^ ~
drivers/ata/pata_atiixp.c:282:19: note: use '=' to turn this equality comparison into an assignment

Quoted 3 lines
        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
                         ^~
                         =

Yeah, I don't think assignment and conditional checking was implied here. Thanks for the simple fix.

Quoted 24 lines

1 warning generated.

---
 drivers/ata/pata_atiixp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_atiixp.c +1 -2
index 4d49fd3c927b..843bb200a1ee 100644
@@ -279,7 +279,7 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        const struct ata_port_info *ppi[] = { &info, &info };
 
        /* SB600 doesn't have secondary port wired */
-       if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
+       if (pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE)
                ppi[1] = &ata_dummy_port_info;
 
        return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
--

2.18.0

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
In reply to Nathan Chancellor
Quoted 13 lines · Nathan Chancellor

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/ata/pata_atiixp.c:282:19: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
            ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/ata/pata_atiixp.c:282:19: note: remove extraneous parentheses around the comparison to silence this warning
if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
~ ^ ~
drivers/ata/pata_atiixp.c:282:19: note: use '=' to turn this equality comparison into an assignment

Quoted 4 lines
        if((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE))
                         ^~
                         =

1 warning generated.

Applied for 4.20, thanks.

Signature · 1 line
Jens Axboe