From patchwork Wed Sep 12 06:01:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 11343 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 32D6823E41 for ; Wed, 12 Sep 2012 06:04:16 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id DC7A33D3A748 for ; Wed, 12 Sep 2012 06:04:14 +0000 (UTC) Received: by iafj25 with SMTP id j25so1009062iaf.11 for ; Tue, 11 Sep 2012 23:04:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=b5MMMVpoe4jof2jJT0DTVSgzk7HwBh8c723QromP1pA=; b=Ezsep83Pcz07nrm5IMqMztcA54RDkFeeIHGIhAkwqP05itiKNb3Ir1/jiIe+wnzRHh kxC1VdilyJRN8kM8QBH2g5bKf28NDKiDEgrKfGfFAkmiMWaChC4ArEeptAUJfotWKdw9 2icKLkT0vZoMFY+SkWm8ZQ5pm+Gei9ADCLkD683CQGYyCNr/0mPH7U/myMq5m/rBhqNd 4p+OBBg7b3TMz95NefwMEVb9Sjni60/ry0rEmCBZQzzIJSukZ8ormTR66x3DtE/rLsqZ xELb0RjXjXXruo3mfiZHXNVyIToiiyIaYdtF5Vm0vwa1P46GDr7xkQOHgHeNcUhFvj1i i7LA== Received: by 10.50.89.164 with SMTP id bp4mr351093igb.28.1347429854239; Tue, 11 Sep 2012 23:04:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp52801igc; Tue, 11 Sep 2012 23:04:13 -0700 (PDT) Received: by 10.68.193.196 with SMTP id hq4mr15665374pbc.32.1347429853419; Tue, 11 Sep 2012 23:04:13 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id gh6si28173888pbc.147.2012.09.11.23.04.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 23:04:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by dade7 with SMTP id e7so927423dad.37 for ; Tue, 11 Sep 2012 23:04:12 -0700 (PDT) Received: by 10.66.75.104 with SMTP id b8mr30607059paw.21.1347429852680; Tue, 11 Sep 2012 23:04:12 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id ou6sm4738880pbc.9.2012.09.11.23.04.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 23:04:12 -0700 (PDT) From: Sachin Kamat To: linux-leds@vger.kernel.org Cc: bryan.wu@canonical.com, fengguang.wu@intel.com, kernel-janitors@vger.kernel.org, sachin.kamat@linaro.org, patches@linaro.org, Shreshtha Kumar SAHU Subject: [PATCH] leds-lm3530: Fix smatch warnings Date: Wed, 12 Sep 2012 11:31:08 +0530 Message-Id: <1347429668-14419-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkwUSKUMCOFKXQL8DKBxlWnsueiIfgSOrg0MyuZop9zkecxCkYojnb2tCRtAgQeTcKIAL5l Fixes the following smatch warnings: drivers/leds/leds-lm3530.c:361 lm3530_mode_set() info: why not propagate 'mode' from lm3530_get_mode_from_str() instead of -22? drivers/leds/leds-lm3530.c:432 lm3530_probe() info: why not propagate 'err' from lm3530_init_registers() instead of -19? drivers/leds/leds-lm3530.c:438 lm3530_probe() info: why not propagate 'err' from led_classdev_register() instead of -19? Reported-by: Fengguang Wu Cc: Shreshtha Kumar SAHU Signed-off-by: Sachin Kamat --- drivers/leds/leds-lm3530.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 1e7ed2a..db1de54 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -150,7 +150,7 @@ static int lm3530_get_mode_from_str(const char *str) if (sysfs_streq(str, mode_map[i].mode)) return mode_map[i].mode_val; - return -1; + return -EINVAL; } static void lm3530_als_configure(struct lm3530_platform_data *pdata, @@ -358,7 +358,7 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute mode = lm3530_get_mode_from_str(buf); if (mode < 0) { dev_err(dev, "Invalid mode\n"); - return -EINVAL; + return mode; } drvdata->mode = mode; @@ -426,16 +426,16 @@ static int __devinit lm3530_probe(struct i2c_client *client, if (drvdata->pdata->brt_val) { err = lm3530_init_registers(drvdata); - if (err < 0) { + if (err) { dev_err(&client->dev, "Register Init failed: %d\n", err); - return -ENODEV; + return err; } } err = led_classdev_register(&client->dev, &drvdata->led_dev); if (err < 0) { dev_err(&client->dev, "Register led class failed: %d\n", err); - return -ENODEV; + return err; } err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode);