From patchwork Sun Jun 26 13:47:27 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: 9199511 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 5A7C260752 for ; Sun, 26 Jun 2016 13:47:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D88C28540 for ; Sun, 26 Jun 2016 13:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 421762854B; Sun, 26 Jun 2016 13:47:49 +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 DBDEC28540 for ; Sun, 26 Jun 2016 13:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056AbcFZNrg (ORCPT ); Sun, 26 Jun 2016 09:47:36 -0400 Received: from mout.web.de ([212.227.17.12]:54033 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbcFZNrf (ORCPT ); Sun, 26 Jun 2016 09:47:35 -0400 Received: from [192.168.1.2] ([77.182.59.103]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LxfGh-1bR96P0GmR-017Hnl; Sun, 26 Jun 2016 15:47:30 +0200 Subject: [PATCH 2/6] mfd: twl-core: Refactoring for add_numbered_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: <9cf59380-e999-0cf8-9b8d-106691b86d0b@users.sourceforge.net> Date: Sun, 26 Jun 2016 15:47:27 +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:r+YgQ5CmX8CJ/TajuF7VXBUOSBxepf2xoJiNmoWuHDGpHsLDUuc aYkSkNNh/mMeRd3cK11eh6p+12PbnDZYexGQfDGbSWO2r+oc2c6AAzWUfqZuF3u0iyvkaGF ooD9ndORYL79fAJ2uJU9OHsckIzLxzKdOMZBiD9+KrtGHLztPoC/ms94CZrajTzP2K8lV1M BkHUg6Uf598OI9ZDLIpIg== X-UI-Out-Filterresults: notjunk:1; V01:K0:4h6glbksPDw=:OtMwrd+ExU7o1pzkDRhH4z 7eaIXL6MVyr9c5VY+jto6ELM7pXpnkFTNVj3aQvH+Q+CKd+l9rq/JuFFbLbgKwImMJ11ZUDre unYiC02+VJbdI//xj0ywchi+5zEYeo5r339TsMQpoXEg27Dpi6+0yIn4wW2HQUaQbkA/U8wMP 1YMdybJJxf+VHX2KGb5eV3xkJxObRmBDk2NuOG8iL0/68Qk8areGRo7kRX/sSdxY+wM7Ag5EN 04jjMtwtXV3Z/CVx2mjO/yDAymXWa3KQj2cLCFdWDb/KmK67PGy7s2JDKDMwIoysb0tvmAAON +RtBabbY2QGQRyUhKo42jkEzbL2j5tVFznQl4TCDPpV4rOPSnnHjyNTtrEbHF1L2To08GtUo5 94hlNgUyk11fBuQzR8oAntMf2tNaJFEOkiNFDv7zlGdG0ZIOSHvV/8+Py48T08LEv8NSOlkYV YpOMb9EunRa+jvZElB1I2A1uRWmRMlPQG9i9P1RjDFvOdrQXa745p4cTSaUoub54QaG591TC+ JsyOdSMqecoQ4HbKuBme0ifFRZ7iIuya0lW6+/2QXhKaWQTbcK1MZl/Bpsj6nV+NCREQsce3E 6vMlochJVSymBSKnpNRyv0cRLb2tb9D+CO7i6cG/rq5h6LUBUZ5ftABHpi0IOOUxqZdsHhf0+ e0JGfdnedUxWpfj4qCXUDazSz++hTv3pWZPnSJQEXttRk8R6IWsgd08PaB6LBYbhq/ghuxW7u EI6XMtZXbUaVUGS0Lh+mfzf3UEEV6D7rU+pZEQuqF+4LoL7+oXbl35/uE0C5yq8hHAjG4yG7W xfX3aW6 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:03:59 +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 Acked-by: Lee Jones --- drivers/mfd/twl-core.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 9458c6d..a49d3db 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -631,7 +631,7 @@ add_numbered_child(unsigned mod_no, const char *name, int num, 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; } } @@ -644,21 +644,22 @@ add_numbered_child(unsigned mod_no, const char *name, int num, status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1); if (status < 0) { dev_dbg(&pdev->dev, "can't add irqs\n"); - goto err; + goto put_device; } } status = platform_device_add(pdev); - if (status == 0) - device_init_wakeup(&pdev->dev, can_wakeup); + if (status) + goto put_device; + + device_init_wakeup(&pdev->dev, can_wakeup); -err: - if (status < 0) { - platform_device_put(pdev); - dev_err(&twl->client->dev, "can't add %s dev\n", name); - return ERR_PTR(status); - } return &pdev->dev; + +put_device: + platform_device_put(pdev); + dev_err(&twl->client->dev, "failed to add device %s\n", name); + return ERR_PTR(status); } static inline struct device *add_child(unsigned mod_no, const char *name,