Skip to contentSkip to conversation

staging: mt7621-pci: fix a multiple assignment code style issue

PATCH In review Iain Craig 3 participants 3 messages Apr 27, 2021

Subsystems (2)
lore
Share & tools
lore

Iain Craig

author
#0 lore raw

PATCH 1/1 staging: mt7621-pci: fix a multiple assignment code style issue

avoid multiple assignments while setting pcie->io members to NULL.

---
 drivers/staging/mt7621-pci/pci-mt7621.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/mt7621-pci/pci-mt7621.c +3 -1
index 115250115f10..f3b5b8ac03b5 100644
@@ -306,7 +306,9 @@ static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host)
 	 * resource manually instead.
 	 */
 	pcie->io.name = node->full_name;
-	pcie->io.parent = pcie->io.child = pcie->io.sibling = NULL;
+	pcie->io.parent = NULL;
+	pcie->io.child = NULL;
+	pcie->io.sibling = NULL;
 	for_each_of_pci_range(&parser, &range) {
 		switch (range.flags & IORESOURCE_TYPE_BITS) {
 		case IORESOURCE_IO:
Signature · 1 line
2.25.1
#1 lore raw

Hi Iain.

Quoted 13 lines · Iain Craig

avoid multiple assignments while setting pcie->io members to NULL.

---
 drivers/staging/mt7621-pci/pci-mt7621.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/mt7621-pci/pci-mt7621.c +0 -0
index 115250115f10..f3b5b8ac03b5 100644

drivers/staging/mt7621-pci/pci-mt7621.c static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host) · line 311

Quoted 7 lines
drivers/staging/mt7621-pci/pci-mt7621.c +3 -1
@@ -306,7 +306,9 @@ static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host)
         * resource manually instead.
         */
        pcie->io.name = node->full_name;
-       pcie->io.parent = pcie->io.child = pcie->io.sibling = NULL;
+       pcie->io.parent = NULL;
+       pcie->io.child = NULL;
+       pcie->io.sibling = NULL;

In this particular case I think the original code is correct as it is. Also this is the style used around different kernel places to assign these fields.

Quoted 6 lines
drivers/staging/mt7621-pci/pci-mt7621.c +0 -1
        for_each_of_pci_range(&parser, &range) {
                switch (range.flags & IORESOURCE_TYPE_BITS) {
                case IORESOURCE_IO:
--

2.25.1

Best regards,
Sergio Paracuellos

Quoted 1 line
#2 lore raw
Quoted 11 lines · Sergio Paracuellos

Hi Iain.

Quoted 8 lines · Iain Craig

avoid multiple assignments while setting pcie->io members to NULL.

---
 drivers/staging/mt7621-pci/pci-mt7621.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 16 lines

drivers/staging/mt7621-pci/pci-mt7621.c static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host) · line 311

Quoted 12 lines
drivers/staging/mt7621-pci/pci-mt7621.c +3 -1
index 115250115f10..f3b5b8ac03b5 100644
@@ -306,7 +306,9 @@ static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host)
         * resource manually instead.
         */
        pcie->io.name = node->full_name;
-       pcie->io.parent = pcie->io.child = pcie->io.sibling = NULL;
+       pcie->io.parent = NULL;
+       pcie->io.child = NULL;
+       pcie->io.sibling = NULL;

In this particular case I think the original code is correct as it is. Also this is the style used around different kernel places to assign these fields.

THe original is fine.

thanks,

greg k-h