drivers/char/mxser.c : change pci_find_device by
Subsystems (3)
PATCH 1/1 drivers/char/mxser.c : change pci_find_device by
From: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter, so unload could be done.
---
drivers/char/mxser.c +7 -2
@@ -817,7 +817,7 @@ static int mxser_init(void) index =0 ; b =0 ;while (b < n) { - pdev =pci_find_device (mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev); + pdev =pci_get_device (mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev);if (pdev ==NULL ) { b++;continue ;
@@ -832,6 +832,7 @@ static int mxser_init(void) }else {if (pci_enable_device (pdev)) {printk (KERN_ERR "Moxa SmartI/O PCI enable fail !\n" ); +pci_dev_put (pdev);continue ; } retval =mxser_get_PCI_conf (busnum, devnum, (int ) mxser_pcibrds[b].driver_data, &hwconf);
@@ -844,15 +845,19 @@ static int mxser_init(void)printk (KERN_ERR "Invalid interrupt vector,board not configured\n" ); else if (retval == MXSER_ERR_IOADDR) printk(KERN_ERR "Invalid I/O address,board not configured\n"); +pci_dev_put (pdev); continue; }mxser_getcfg (m, &hwconf);//init mxsercfg first, or mxsercfg data is not correct on ISR. //mxser_initbrd will hook ISR. -if (mxser_initbrd (m, &hwconf) <0 ) +if (mxser_initbrd (m, &hwconf) <0 ) { +pci_dev_put (pdev);continue ; + } m++; } +pci_dev_put (pdev); }#endif
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 24 lines · trem
From: trem <[email protected]>
This patch simply change
pci_find_devicebypci_get_device, becausepci_find_deviceis deprecated.pci_dev_puthas been added to decrement the counter, so unload could be done.Signed-off-by trem <[email protected]>---
drivers/char/mxser.c +1
-1@@ -817,7 +817,7 @@ static int mxser_init(void) index =0 ; b =0 ;while (b < n) { - pdev =pci_find_device (mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev); + pdev =pci_get_device (mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev);if (pdev ==NULL ) { b++;continue ;
drivers/char/mxser.c static int mxser_init(void) · line 835
Quoted 4 lines
drivers/char/mxser.c +1
-0@@ -832,6 +832,7 @@ static int mxser_init(void) }else {if (pci_enable_device (pdev)) {printk (KERN_ERR "Moxa SmartI/O PCI enable fail !\n" ); +pci_dev_put (pdev);
No, you double decrement this, not good.
Quoted 11 lines
drivers/char/mxser.c +1
-0continue ; } retval =mxser_get_PCI_conf (busnum, devnum, (int ) mxser_pcibrds[b].driver_data, &hwconf);@@ -844,15 +845,19 @@ static int mxser_init(void)printk (KERN_ERR "Invalid interrupt vector,board not configured\n" ); else if (retval == MXSER_ERR_IOADDR) printk(KERN_ERR "Invalid I/O address,board not configured\n"); +pci_dev_put (pdev);continue ; }mxser_getcfg (m, &hwconf);
drivers/char/mxser.c static int mxser_init(void) · line 860
Quoted 10 lines
drivers/char/mxser.c +4
-1//init mxsercfg first, or mxsercfg data is not correct on ISR. //mxser_initbrd will hook ISR. -if (mxser_initbrd (m, &hwconf) <0 ) +if (mxser_initbrd (m, &hwconf) <0 ) { +pci_dev_put (pdev);continue ; + } m++; } +pci_dev_put (pdev);
Again, double decrement, which is a bug.
Please read the documentation for how pci_get_device() works before sending further patches.
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors