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]
Date:	Wed, 12 Dec 2012 14:03:05 +0000
From:	"Kim, Milo" <Milo.Kim@...com>
To:	Bryan Wu <cooloney@...il.com>
CC:	"linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 29/33] leds-lp5521: recovers previous driver patch for
 return value

 During the cleanup, Dan Carpenter's patch was removed.
 This patch recovers his patch based on the latest lp5521 driver.

  [PATCH] leds: leds-lp5521: return an error code on error in probe()
  If "buf" wasn't equal to LP5521_REG_R_CURR_DEFAULT the probe fails but
  we still return zero.  I've changed it to print an error message and
  return -EINVAL.

Cc: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Milo(Woogyom) Kim <milo.kim@...com>
---
 drivers/leds/leds-lp5521.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 23d0bee..9de5aec 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -278,11 +278,18 @@ static int lp5521_post_init_device(struct lp55xx_chip *chip)
 	 * LP5521_REG_ENABLE register will not have any effect - strange!
 	 */
 	ret = lp55xx_read(chip, LP5521_REG_R_CURRENT, &val);
-	if (ret || val != LP5521_REG_R_CURR_DEFAULT) {
+	if (ret) {
 		dev_err(&chip->cl->dev, "error in resetting chip\n");
 		return ret;
 	}
 
+	if (val != LP5521_REG_R_CURR_DEFAULT) {
+		dev_err(&chip->cl->dev,
+			"unexpected data in register (expected 0x%x got 0x%x)\n",
+			LP5521_REG_R_CURR_DEFAULT, val);
+		return -EINVAL;
+	}
+
 	usleep_range(10000, 20000);
 
 	/* Set all PWMs to direct control mode */
-- 
1.7.9.5


Best Regards,
Milo


--
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