2019-06-02 15:42:48

by Emanuel Bennici

[permalink] [raw]
Subject: [PATCH 1/2] pci: shpchp: Correct usage of 'return'

Replace 'return(1)' with 'return 1' because return is not a function.

Signed-off-by: Emanuel Bennici <[email protected]>
---
drivers/pci/hotplug/shpchp_ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 078003dcde5b..a7b807b31726 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -342,7 +342,7 @@ static int remove_board(struct slot *p_slot)
int rc;

if (shpchp_unconfigure_device(p_slot))
- return(1);
+ return 1;

hp_slot = p_slot->device - ctrl->slot_device_offset;
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
--
2.19.1


2019-06-02 15:42:48

by Emanuel Bennici

[permalink] [raw]
Subject: [PATCH 2/2] pci: cpqphp: Correct usage of 'return'

'return' is not correctly used here.
This Patch replaces 'return(n)' with 'return n'.

Signed-off-by: Emanuel Bennici <[email protected]>
---
drivers/pci/hotplug/cpqphp_nvram.c | 48 +++++++++++++++---------------
drivers/pci/hotplug/cpqphp_pci.c | 24 +++++++--------
drivers/pci/hotplug/shpchp_ctrl.c | 2 +-
3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c
index 00cd2b43364f..2a2ffc9650d7 100644
--- a/drivers/pci/hotplug/cpqphp_nvram.c
+++ b/drivers/pci/hotplug/cpqphp_nvram.c
@@ -98,25 +98,25 @@ static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail)
u8 **tByte;

if ((*used + 1) > *avail)
- return(1);
+ return 1;

*((u8 *)*p_buffer) = value;
tByte = (u8 **)p_buffer;
(*tByte)++;
*used += 1;
- return(0);
+ return 0;
}


static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail)
{
if ((*used + 4) > *avail)
- return(1);
+ return 1;

**p_buffer = value;
(*p_buffer)++;
*used += 4;
- return(0);
+ return 0;
}


@@ -174,7 +174,7 @@ static u32 access_EV(u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size)
: "%ebx", "%edx");
spin_unlock_irqrestore(&int15_lock, flags);

- return((ret_val & 0xFF00) >> 8);
+ return ((ret_val & 0xFF00) >> 8);
}


@@ -236,12 +236,12 @@ static u32 store_HRT(void __iomem *rom_start)
available = 1024;

if (!check_for_compaq_ROM(rom_start))
- return(1);
+ return 1;

buffer = (u32 *) evbuffer;

if (!buffer)
- return(1);
+ return 1;

pFill = buffer;
usedbytes = 0;
@@ -253,12 +253,12 @@ static u32 store_HRT(void __iomem *rom_start)
/* The revision of this structure */
rc = add_byte(&pFill, 1 + ctrl->push_flag, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* The number of controllers */
rc = add_byte(&pFill, 1, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

while (ctrl) {
p_ev_ctrl = (struct ev_hrt_ctrl *) pFill;
@@ -268,22 +268,22 @@ static u32 store_HRT(void __iomem *rom_start)
/* The bus number */
rc = add_byte(&pFill, ctrl->bus, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* The device Number */
rc = add_byte(&pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* The function Number */
rc = add_byte(&pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* Skip the number of available entries */
rc = add_dword(&pFill, 0, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* Figure out memory Available */

@@ -297,12 +297,12 @@ static u32 store_HRT(void __iomem *rom_start)
/* base */
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* length */
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

resNode = resNode->next;
}
@@ -322,12 +322,12 @@ static u32 store_HRT(void __iomem *rom_start)
/* base */
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* length */
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

resNode = resNode->next;
}
@@ -347,12 +347,12 @@ static u32 store_HRT(void __iomem *rom_start)
/* base */
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* length */
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

resNode = resNode->next;
}
@@ -372,12 +372,12 @@ static u32 store_HRT(void __iomem *rom_start)
/* base */
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

/* length */
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
if (rc)
- return(rc);
+ return rc;

resNode = resNode->next;
}
@@ -402,10 +402,10 @@ static u32 store_HRT(void __iomem *rom_start)

if (rc) {
err(msg_unable_to_save);
- return(1);
+ return 1;
}

- return(0);
+ return 0;
}


@@ -626,7 +626,7 @@ int compaq_nvram_load(void __iomem *rom_start, struct controller *ctrl)
rc &= cpqhp_resource_sort_and_combine(&(ctrl->bus_head));

if (rc)
- return(rc);
+ return rc;
} else {
if ((evbuffer[0] != 0) && (!ctrl->push_flag))
return 1;
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
index 1b2b3f3b648b..a8995c91cbbc 100644
--- a/drivers/pci/hotplug/cpqphp_pci.c
+++ b/drivers/pci/hotplug/cpqphp_pci.c
@@ -502,7 +502,7 @@ int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot)
*/
rc = cpqhp_save_config(ctrl, sub_bus, 0);
if (rc)
- return(rc);
+ return rc;
ctrl->pci_bus->number = new_slot->bus;

}
@@ -669,7 +669,7 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func)
func = cpqhp_slot_find(func->bus, func->device, index++);
}

- return(0);
+ return 0;
}


@@ -852,7 +852,7 @@ int cpqhp_save_used_resources(struct controller *ctrl, struct pci_func *func)
mem_node->next = func->mem_head;
func->mem_head = mem_node;
} else
- return(1);
+ return 1;
}
} /* End of base register loop */
/* Standard header */
@@ -923,7 +923,7 @@ int cpqhp_save_used_resources(struct controller *ctrl, struct pci_func *func)
mem_node->next = func->mem_head;
func->mem_head = mem_node;
} else
- return(1);
+ return 1;
}
} /* End of base register loop */
}
@@ -1038,7 +1038,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)
unsigned int devfn;

if (!func->is_a_board)
- return(ADD_NOT_SUPPORTED);
+ return ADD_NOT_SUPPORTED;

func = cpqhp_slot_find(func->bus, func->device, index++);

@@ -1050,17 +1050,17 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)

/* No adapter present */
if (temp_register == 0xFFFFFFFF)
- return(NO_ADAPTER_PRESENT);
+ return NO_ADAPTER_PRESENT;

if (temp_register != func->config_space[0])
- return(ADAPTER_NOT_SAME);
+ return ADAPTER_NOT_SAME;

/* Check for same revision number and class code */
pci_bus_read_config_dword(pci_bus, devfn, PCI_CLASS_REVISION, &temp_register);

/* Adapter not the same */
if (temp_register != func->config_space[0x08 >> 2])
- return(ADAPTER_NOT_SAME);
+ return ADAPTER_NOT_SAME;

/* Check for Bridge */
pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
@@ -1099,7 +1099,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)
*/
if (!((func->config_space[0] == 0xAE100E11)
&& (temp_register == 0x00L)))
- return(ADAPTER_NOT_SAME);
+ return ADAPTER_NOT_SAME;
}
/* Figure out IO and memory base lengths */
for (cloop = 0x10; cloop <= 0x24; cloop += 4) {
@@ -1132,10 +1132,10 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)

/* Check information in slot structure */
if (func->base_length[(cloop - 0x10) >> 2] != base)
- return(ADAPTER_NOT_SAME);
+ return ADAPTER_NOT_SAME;

if (func->base_type[(cloop - 0x10) >> 2] != type)
- return(ADAPTER_NOT_SAME);
+ return ADAPTER_NOT_SAME;

} /* End of base register loop */

@@ -1144,7 +1144,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)
/* this is not a type 0 or 1 config space header so
* we don't know how to do it
*/
- return(DEVICE_TYPE_NOT_SUPPORTED);
+ return DEVICE_TYPE_NOT_SUPPORTED;
}

/* Get the next function */
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index a7b807b31726..ea58f9b1d43c 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -327,7 +327,7 @@ static int board_added(struct slot *p_slot)
return rc;
}

- return(rc);
+ return rc;
}


--
2.19.1

2019-06-03 12:17:36

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] pci: shpchp: Correct usage of 'return'

On Sun, Jun 02, 2019 at 05:38:01PM +0200, Emanuel Bennici wrote:
> Replace 'return(1)' with 'return 1' because return is not a function.
>
> Signed-off-by: Emanuel Bennici <[email protected]>

Reviewed-by: Mika Westerberg <[email protected]>