Re: Fix get_##name return value problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jesse Barnes wrote:
> On Sunday, September 21, 2008 11:26 pm Zhao, Yu wrote:
>> The get_##name in pci_hotplug_core.c always returns 0, which fails its
>> callers to conclude right operations. Change it to return proper values on
>> failure.
>>
>> Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
> 
> Applied to linux-next, thanks.
> 
> Jesse
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

The commit 356a9d6f3dd283f83861adf1ac909879f0e66411 (PCI: fix hotplug
get_##name return value problem) doesn't seem to be merged properly.
Because of this, PCI hotplug no longer works (Read/Write PCI hotplug
files always returns -ENODEV).

The following patch fixes this problem.

Thanks,
Kenji Kaneshige


This patch fixes wrong check of try_module_get() return value check in
get_##name().

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>

---
 drivers/pci/hotplug/pci_hotplug_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-next/drivers/pci/hotplug/pci_hotplug_core.c
===================================================================
--- linux-next.orig/drivers/pci/hotplug/pci_hotplug_core.c
+++ linux-next/drivers/pci/hotplug/pci_hotplug_core.c
@@ -102,7 +102,7 @@ static int get_##name (struct hotplug_sl
 {									\
 	struct hotplug_slot_ops *ops = slot->ops;			\
 	int retval = 0;							\
-	if (try_module_get(ops->owner))					\
+	if (!try_module_get(ops->owner))				\
 		return -ENODEV;						\
 	if (ops->get_##name)						\
 		retval = ops->get_##name(slot, value);			\


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux