lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4800070.0oRyxTVZ40@wasted.cogentembedded.com>
Date:	Sat, 17 Jan 2015 22:14:41 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: [PATCH] driver core: use *switch* statement in really_probe()

There are series of comparisons of the 'ret' variable on the failure path of
really_probe(),  so the  *switch* statement  seems  more appropriate there.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>

---
The patch is against the 'driver-core-next' branch of Greg KH's 'driver-core.git'
repo.

 drivers/base/dd.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Index: driver-core/drivers/base/dd.c
===================================================================
--- driver-core.orig/drivers/base/dd.c
+++ driver-core/drivers/base/dd.c
@@ -320,21 +320,25 @@ probe_failed:
 	dev->driver = NULL;
 	dev_set_drvdata(dev, NULL);
 
-	if (ret == -EPROBE_DEFER) {
+	switch (ret) {
+	case -EPROBE_DEFER:
 		/* Driver requested deferred probing */
 		dev_info(dev, "Driver %s requests probe deferral\n", drv->name);
 		driver_deferred_probe_add(dev);
 		/* Did a trigger occur while probing? Need to re-trigger if yes */
 		if (local_trigger_count != atomic_read(&deferred_trigger_count))
 			driver_deferred_probe_trigger();
-	} else if (ret != -ENODEV && ret != -ENXIO) {
+		break;
+	case -ENODEV:
+	case -ENXIO:
+		pr_debug("%s: probe of %s rejects match %d\n",
+			 drv->name, dev_name(dev), ret);
+		break;
+	default:
 		/* driver matched but the probe failed */
 		printk(KERN_WARNING
 		       "%s: probe of %s failed with error %d\n",
 		       drv->name, dev_name(dev), ret);
-	} else {
-		pr_debug("%s: probe of %s rejects match %d\n",
-		       drv->name, dev_name(dev), ret);
 	}
 	/*
 	 * Ignore errors returned by ->probe so that the next driver can try

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ