[PATCH 77/79] staging: comedi: ni_labpc: cleanup dev->board_name usage

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

 



The dev->board_name is initialized by the comedi core before calling
the (*attach) or (*auto_attach) functions. It only needs to be updated
if the driver does any additional probing and changes the dev->board_ptr.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_labpc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 22f8d45..e46854f 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1616,8 +1616,6 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
 	int ret;
 	int i;
 
-	dev->board_name = board->name;
-
 	if (iobase == 0)
 		return -EINVAL;
 	if (board->bustype == isa_bustype) {
@@ -1831,6 +1829,7 @@ static int labpc_auto_attach(struct comedi_device *dev,
 				       unsigned long context_unused)
 {
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+	const struct labpc_boardinfo *board;
 	struct labpc_private *devpriv;
 	unsigned long iobase;
 	unsigned int irq;
@@ -1848,9 +1847,11 @@ static int labpc_auto_attach(struct comedi_device *dev,
 		return -ENOMEM;
 	dev->private = devpriv;
 
-	dev->board_ptr = labpc_pci_find_boardinfo(pcidev);
-	if (!dev->board_ptr)
+	board = labpc_pci_find_boardinfo(pcidev);
+	if (!board)
 		return -ENODEV;
+	dev->board_ptr = board;
+	dev->board_name = board->name;
 	devpriv->mite = mite_alloc(pcidev);
 	if (!devpriv->mite)
 		return -ENOMEM;
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux