Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1285250

[PATCH 02/19] mfd: ab3100-core.c: Fix multiple warnings reported by Checkpatch

From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 02/19] mfd: ab3100-core.c: Fix multiple warnings reported by Checkpatch
Date 2015-12-07 13:00 +0100
Message-ID <qD2Cw-3Yl-53@gated-at.bofh.it> (permalink)
References <qD2Ct-3Yl-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


WARNING: Missing a blank line after declarations
+       struct ab3100 *ab3100 = dev_get_drvdata(dev->parent);
+       if (!ab3100->startup_events_read)

WARNING: Possible unnecessary 'out of memory' message
+       if (!ab3100) {
+               dev_err(&client->dev, "could not allocate AB3100 device\n");

WARNING: else is not generally useful after a break or return
+                               break;
+                       } else {

total: 0 errors, 3 warnings, 996 lines checked

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/ab3100-core.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index f0afb44..6a5a988 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -381,9 +381,11 @@ static int ab3100_event_registers_startup_state_get(struct device *dev,
 					     u8 *event)
 {
 	struct ab3100 *ab3100 = dev_get_drvdata(dev->parent);
+
 	if (!ab3100->startup_events_read)
 		return -EAGAIN; /* Try again later */
 	memcpy(event, ab3100->startup_events, 3);
+
 	return 0;
 }
 
@@ -858,10 +860,8 @@ static int ab3100_probe(struct i2c_client *client,
 	int i;
 
 	ab3100 = devm_kzalloc(&client->dev, sizeof(struct ab3100), GFP_KERNEL);
-	if (!ab3100) {
-		dev_err(&client->dev, "could not allocate AB3100 device\n");
+	if (!ab3100)
 		return -ENOMEM;
-	}
 
 	/* Initialize data structure */
 	mutex_init(&ab3100->access_mutex);
@@ -883,20 +883,17 @@ static int ab3100_probe(struct i2c_client *client,
 
 	for (i = 0; ids[i].id != 0x0; i++) {
 		if (ids[i].id == ab3100->chip_id) {
-			if (ids[i].name != NULL) {
-				snprintf(&ab3100->chip_name[0],
-					 sizeof(ab3100->chip_name) - 1,
-					 "AB3100 %s",
-					 ids[i].name);
+			if (ids[i].name)
 				break;
-			} else {
-				dev_err(&client->dev,
-					"AB3000 is not supported\n");
-				goto exit_no_detect;
-			}
+
+			dev_err(&client->dev, "AB3000 is not supported\n");
+			goto exit_no_detect;
 		}
 	}
 
+	snprintf(&ab3100->chip_name[0],
+		 sizeof(ab3100->chip_name) - 1, "AB3100 %s", ids[i].name);
+
 	if (ids[i].id == 0x0) {
 		dev_err(&client->dev, "unknown analog baseband chip id: 0x%x\n",
 			ab3100->chip_id);
-- 
1.9.1

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 00/19] mfd: Lots of clean-ups Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 15/19] mfd: cs5535-mfd: Add missing line spacing and make local array static Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 08/19] mfd: adp5520: Some trivial 'no space before tab' fixes Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 04/19] mfd: ab8500-core: Fix many warnings reported by Checkpatch Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 11/19] mfd: as3711: Repair OOM and 'line over 80 chars' formatting warnings Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 17/19] mfd: da9052-i2c: Fix tabbing/whitespace issue Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 16/19] mfd: da903x: Fix white space and split string issues Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 03/19] mfd: ab2100-otp: Remove pointless 'out of memory' error message Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 05/19] mfd: ab8500-debugfs: Clean-up non-conforming commenting and print formatting Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 18/19] mfd: da9052-irq: Fix trivial 'space before comma' error Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 06/19] mfd: ab8500-gpadc: Squash a whole bunch of Checkpatch warnings and one error Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 01/19] mfd: aat2870-core: Remove unnecessary 'out of memory' message Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
  [PATCH 10/19] mfd: arizona-i2c: Add blank line formatting after declaration Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100
    Re: [PATCH 10/19] mfd: arizona-i2c: Add blank line formatting after  declaration Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2015-12-08 15:40 +0100
  [PATCH 02/19] mfd: ab3100-core.c: Fix multiple warnings reported by Checkpatch Lee Jones <lee.jones@linaro.org> - 2015-12-07 13:00 +0100

csiph-web