]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: Fix reversed test in comedi_device_attach()
authorIan Abbott <abbotti@mev.co.uk>
Tue, 14 Aug 2012 10:29:17 +0000 (11:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2012 02:31:43 +0000 (19:31 -0700)
commit 80eb7a506fdcea08f86c9dfc7c638303bf02a3c8 upstream.

Commit 3902a370281d2f2b130f141e8cf94eab40125769 (staging: comedi:
refactor comedi_device_attach() a bit) by yours truly introduced an
inverted logic bug in comedi_device_attach() for the case where the
driver expects the device to be configured by driver name rather than
board name.  The result of a strcmp() is being tested incorrectly.  Fix
it.

Thanks to Stephen N Chivers for discovering the bug and suggesting the
fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers.c

index aeac1caba3f9918b2f574afc4189bd05743f403c..327c0ce494b0302b07a6533984d113176e1a9a85 100644 (file)
@@ -144,7 +144,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                        dev->board_ptr = comedi_recognize(driv, it->board_name);
                        if (dev->board_ptr)
                                break;
-               } else if (strcmp(driv->driver_name, it->board_name))
+               } else if (strcmp(driv->driver_name, it->board_name) == 0)
                        break;
                module_put(driv->module);
        }