2008-08-27 22:06:29

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] fix pciehp_free_irq()

This patch fixes an obvious bug (loop was never entered) caused by
commit 820943b6fc4781621dee52ba026106758a727dd3
(pciehp: cleanup pcie_poll_cmd).

Reported-by: Adrian Bunk <[email protected]>
Signed-off-by: Adrian Bunk <[email protected]>

---
0cca78f4b7c7d6c7b64ae5acc08bb641454b4835
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index ab31f5b..9d934dd 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -250,23 +250,23 @@ static inline void pciehp_free_irq(struct controller *ctrl)
static int pcie_poll_cmd(struct controller *ctrl)
{
u16 slot_status;
int timeout = 1000;

if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
if (slot_status & CMD_COMPLETED) {
pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
return 1;
}
}
- while (timeout > 1000) {
+ while (timeout > 0) {
msleep(10);
timeout -= 10;
if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
if (slot_status & CMD_COMPLETED) {
pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
return 1;
}
}
}
return 0; /* timeout */
}


2008-08-29 02:46:17

by Kenji Kaneshige

[permalink] [raw]
Subject: Re: [2.6 patch] fix pciehp_free_irq()

Adrian Bunk wrote:
> This patch fixes an obvious bug (loop was never entered) caused by
> commit 820943b6fc4781621dee52ba026106758a727dd3
> (pciehp: cleanup pcie_poll_cmd).
>
> Reported-by: Adrian Bunk <[email protected]>
> Signed-off-by: Adrian Bunk <[email protected]>
>
> ---
> 0cca78f4b7c7d6c7b64ae5acc08bb641454b4835
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index ab31f5b..9d934dd 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -250,23 +250,23 @@ static inline void pciehp_free_irq(struct controller *ctrl)
> static int pcie_poll_cmd(struct controller *ctrl)
> {
> u16 slot_status;
> int timeout = 1000;
>
> if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
> if (slot_status & CMD_COMPLETED) {
> pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
> return 1;
> }
> }
> - while (timeout > 1000) {
> + while (timeout > 0) {
> msleep(10);
> timeout -= 10;
> if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
> if (slot_status & CMD_COMPLETED) {
> pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
> return 1;
> }
> }
> }
> return 0; /* timeout */
> }
>
>

Sorry, that's my bad.
Thank you for the patch, Adrian.

Acked-by: Kenji Kaneshige <[email protected]>

Thanks,
Kenji Kaneshige