From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932375AbcHKMYK (ORCPT ); Thu, 11 Aug 2016 08:24:10 -0400 Received: from mout.web.de ([212.227.17.12]:63922 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbcHKMYH (ORCPT ); Thu, 11 Aug 2016 08:24:07 -0400 Subject: [PATCH v5 1/2] mfd: dm355evm_msp: Refactoring for add_child() To: Lee Jones , kernel-janitors@vger.kernel.org References: <80dc4486-01d1-df66-c9c2-b71ee2251251@users.sourceforge.net> Cc: LKML , Julia Lawall From: SF Markus Elfring Message-ID: <0e48a854-11dc-e4b5-e77c-b7f4ab36eb48@users.sourceforge.net> Date: Thu, 11 Aug 2016 14:23:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <80dc4486-01d1-df66-c9c2-b71ee2251251@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:PW9zkxZfLLc/InVnpcTyq6G1y77GIkFj7rWmpGIHBLqaeI4Otuq tCUctVv8ciZiQ4c155FfecQFwfuJS/ZiW26+E1jGn1Dai1GcO2yh/c7DKaUGzRGZzluvEWK Via6DpfURtLVHXPejkRKjfipk270tzxdZV1Dc05hIziFy3dDg6gAjv+XIfcksHgUm8eUgXR QsPO0Pa8TFFpuR74FVxcw== X-UI-Out-Filterresults: notjunk:1;V01:K0:wqKrSi3Pans=:NXwQ3m9YVsDdu/Jo4GAWe/ n4KvpkCRobMl1I1nzf10ejH47pJGcPeIHh71dVNE9PBumU9WMOBQrxywqiB3ak3hez2Czf2Pr BD4LULY86522tNHilMULyzseIyZayxRydxZTjlj8KVNCWvGkYSOFSdyFNab4oRZ+Fj99AENr8 x+6ov0IE0w1pmKn8w12EgqeG9eyx0IUckRB2H2/Ip07L4tBJVPDIKFEzHw6autY6ofI7aL9T1 m1mbK0gBMXiVUT1iH+PLmQspjAG79cYpuuoQ+Pp3UX+nVmAVsOhF4EXL+riLG8S+weAlhU2d3 KRT5he3poz/vh+GHtQQ6rwUvP/fracTjP36BBrrNJCHlPb2OnX7XZ+ZiZc0e0OJTJLltE2Uh/ hnTT1qz5m3cdp5wK+YT7GaJQerovjzKV/BPoHuPejUjD1mpYj/vNMgpkfYXt+Qlw1pOzrU9Dw E8qTm0KnofrNIBXEk3G6JEWr54fTOyUSdnSWkcViUfZBXerC8v71qXJ8vjEJDHuX5nZ4jwcRQ fSklKP9UwFXaZU1eKXk/u5UFwYyd8gj+FT+Iq29FVNfhoHWqqZCgGAOjFwBRJ06xb+o321sZs 2VaGzNEJB+Xe+ej9FM+q17+x7cLqwmph0N6tAldNwgpF1JGZKyMiovZVCbhXBqAbleAzvQHUw rMq1QdXck9U0LlGdlevN/8fiKOL5ioh/wL8qGskeRfPddzKFGG2KFIYGUsraol/mnJLSoGOvt NSA7ZIbbWGoIDILc0ERt9HdjkO6OrbxK5Vvr0ll9QQl7OFhsHTFSB/1jK3c6/jJt0h/Pg6tEj bXOXtcO Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Thu, 11 Aug 2016 13:30:32 +0200 Adjust jump targets according to the Linux coding style convention. Another check for the variable "status" can be omitted then at the end. Link: https://lkml.kernel.org/g/<20160628163146.GG29166@dell> Signed-off-by: Markus Elfring --- v5: Rebased on the source files from Linux next-20160809. v4: Adjustment of an error message at the end See also a change request for the module "twl-core" on 2016-06-08: https://lkml.kernel.org/g/<20160608111442.GB14888@dell> v3: Deletion of another blank line as requested by Lee Jones v2: Rebasing drivers/mfd/dm355evm_msp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index 270e19c..86eca61 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,20 @@ 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); + if (status) + goto put_device; -err: - if (status < 0) { - platform_device_put(pdev); - dev_err(&client->dev, "can't add %s dev\n", name); - return ERR_PTR(status); - } 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) -- 2.9.2