From patchwork Sun Jun 26 13:50:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9199521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0215260752 for ; Sun, 26 Jun 2016 13:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E84F528540 for ; Sun, 26 Jun 2016 13:51:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC2FB2854B; Sun, 26 Jun 2016 13:51:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90BA028540 for ; Sun, 26 Jun 2016 13:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068AbcFZNur (ORCPT ); Sun, 26 Jun 2016 09:50:47 -0400 Received: from mout.web.de ([212.227.17.12]:57488 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751982AbcFZNuq (ORCPT ); Sun, 26 Jun 2016 09:50:46 -0400 Received: from [192.168.1.2] ([77.182.59.103]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0Ljamy-1bo1Eo15xo-00bXsk; Sun, 26 Jun 2016 15:50:42 +0200 Subject: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() To: Lee Jones , Tony Lindgren , linux-omap@vger.kernel.org References: <566ABCD9.1060404@users.sourceforge.net> <5682D228.7070902@users.sourceforge.net> <20160111082922.GB14104@x1> <05b7db2a-437a-60ac-d289-71d2150e7f5f@users.sourceforge.net> <20160608111442.GB14888@dell> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <75c1cc23-3a2d-db78-d0f2-b5934b18e828@users.sourceforge.net> Date: Sun, 26 Jun 2016 15:50:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:eIg+9aFLJ+4d0mCt8GhxjmCPsCuQb8XgnYBTKxcZDxc/1WMXbtl UjTB7WRijCkVGAkZ1yPvup/c8b0OF8AGjQKJ4cDqp3nCD1TPMHKA0a/KwGNuWk8epzo2BgF iCUP2nHjHqLWNMAnFqskZCt8K5u25fEU6ddo9wspoW/1LH7IFqakQHWS1qpl5KFtnkEd1bC +6k+P/u68mpzi6BOORMhg== X-UI-Out-Filterresults: notjunk:1; V01:K0:hqz0zJUPS9c=:EUwOt9TmXu6x0KJJ5A34G9 0xVNE1G7TcDgqvh96LI3wFAa932Fuc3BhdVZK3HjRwjbLyTK1mU0AV5Ld9RzYyIE6GAULBDKc KBDZdR6FOPRGmSnN4LI2T6wsUXE1R1xlaVoTiFoHTT10Bn+pOKBecFGyEqRKsJcU1zrBrtR5C 2YgJ5cRsjnv/ImSov9DhWp8SUpcoZM9R7BOBvEr6iqoXNnLPtk1TsI2enn2LtSj9icc3Wkd3g KJSm0aO6nqy0qlzumRnnJWtwaGlEx93JayyiSzY/5YBxCiwVgwkklcXpkOWtM+Pt3ZGKPyq2J ZCweHQIei/UBB9kFu5+CcU6x3Ir2x76lURCkHuXkxI2rBBtGDUIkXeAQ7M1MDOTzGADU++ydT l9mWHM0Y7K5AMjh8fhUsXilSFIytIQsnTFR3PeRsucBLlv4PHt5GxEhNwVVAgv+nfhhiT42AK d0SpKdfiTLQLXSgQLAkj3X9BS2y6gB63OKW//BydlERNrYJ9dd1euTC7QZ8uWx5VzEqut2561 MvWrmUSLOM8x/4OQQUzutljuZvLE1aLAttRCfwXn+d26viMk3SQWb9rpd205aml4xNJ1yADtD xbbhqX0daibBP01gYBmUmESHaX2MzdkdsaJhe9r6RBWGyv6oo44S2O9mRJnWUEvlNyciJif2m vxzCyUXLZ2QFD6cZ0uOqq5W0o7WNNrT66TrRVQXGO/0/DjM9gzKJotbaoqmDDVBNBTrXVYamf 6Wg6sSfMK7HkRnVCMtlTz6OBiapr3J5I7/axR7/waUX0TsHcXfMyaF4dyM9RNjbiJvNg89K+t 6uoA1OU Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 26 Jun 2016 13:56:58 +0200 Adjust jump targets according to the Linux coding style convention. Another check for the variable "status" can be omitted then at the end. Signed-off-by: Markus Elfring --- drivers/mfd/dm355evm_msp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index 270e19c..baf6075 100644 --- a/drivers/mfd/dm355evm_msp.c +++ b/drivers/mfd/dm355evm_msp.c @@ -209,7 +209,7 @@ static struct device *add_child(struct i2c_client *client, const char *name, status = platform_device_add_data(pdev, pdata, pdata_len); if (status < 0) { dev_dbg(&pdev->dev, "can't add platform_data\n"); - goto err; + goto put_device; } } @@ -222,19 +222,21 @@ static struct device *add_child(struct i2c_client *client, const char *name, status = platform_device_add_resources(pdev, &r, 1); if (status < 0) { dev_dbg(&pdev->dev, "can't add irq\n"); - goto err; + goto put_device; } } status = platform_device_add(pdev); -err: - if (status < 0) { - platform_device_put(pdev); - dev_err(&client->dev, "can't add %s dev\n", name); - return ERR_PTR(status); - } + if (status) + goto put_device; + return &pdev->dev; + +put_device: + platform_device_put(pdev); + dev_err(&client->dev, "failed to add device %s\n", name); + return ERR_PTR(status); } static int add_children(struct i2c_client *client)