From: Ian Abbott Date: Tue, 14 Aug 2012 10:29:17 +0000 (+0100) Subject: staging: comedi: Fix reversed test in comedi_device_attach() X-Git-Tag: v3.5.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8d54c4c73b719db5cb977b61d14bc0c184050f3;p=thirdparty%2Fkernel%2Fstable.git staging: comedi: Fix reversed test in comedi_device_attach() 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index aeac1caba3f99..327c0ce494b03 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -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); }