From patchwork Fri Sep 16 22:21:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101771 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp708462qgf; Fri, 16 Sep 2016 15:23:04 -0700 (PDT) X-Received: by 10.98.153.1 with SMTP id d1mr26283148pfe.13.1474064584650; Fri, 16 Sep 2016 15:23:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l75si33594550pfb.232.2016.09.16.15.23.04; Fri, 16 Sep 2016 15:23:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbcIPWWx (ORCPT + 4 others); Fri, 16 Sep 2016 18:22:53 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:57045 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbcIPWWx (ORCPT ); Fri, 16 Sep 2016 18:22:53 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MAdid-1bsQRz0RBL-00Bvyr; Sat, 17 Sep 2016 00:21:56 +0200 From: Arnd Bergmann To: Bin Liu , Greg Kroah-Hartman Cc: Arnd Bergmann , David Lechner , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: musb: fix error handling message in probe Date: Sat, 17 Sep 2016 00:21:25 +0200 Message-Id: <20160916222153.1023842-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:6QPrDCkpA+O4YT2vSvJRtayqgAT4YEfq3Id/KoL5qwM1uF8JYxD vw/WOyw4Oy3dDS+twQPSPCGBLxorBbq2JXaYkemkcawZrv1s3q/HjDI9Y46iGfMe6ox286i PSMF9lpp58WQ6zbKSm+lLKykT4bl12dfuUL6TyXKn34A8nw057EAykPmbgHmoYGOrHvOB3b xuorxljqasHtJW+aKOQ5w== X-UI-Out-Filterresults: notjunk:1; V01:K0:AmcZKlJlZCM=:g6/EJtRfBYqh5X25KQSYQr ZD8ogK/dbidG24JvCS+B0+Q9JbzX2vNwpoTpl3S0bx84ixEIcmMHZIaj/0Us1irl5UB7Hhk4Z w2j5GyOgh5afQJITj/6y4QW5kdkKSuz//6X9PmSkLABYJzN581F0xB6ZjyTQkf9leMJDhfuWT 3G7kB0kvFEgzc7Xbu8pvC4hQfgMKij3EKIuVF9Ll6B3gCOmey/q0biKemltNM/K3j3T1a0AP1 zQD5EsETsLThGlXmmBQS4N2IHsy3Mic+ZhPmNr8v8P7hrLpoPkjbS9oi0NaxWXBWKqhr20Pwd h4YcdNgL7jDF9g4vUVFlHRs9t7sIHGJALvc8CmwirT/iOHDfqzXQE4ZXBfqFpE+TMVN3GuAyp klZbQu5izrSZf+L5G/J2dNGN3qNGVDmmmiEbID6ieT5dgie/9LB/Rmlb3eZzQB5C6kRQdiJSF l6UHxHJ5DpQKA3Qfs1GpekQjDLcRctcA3UENcrPqX1H5YQmowpp0SGlcaIM4pjhQYiT1413eN 11hIVfl74/493kG+B2kZFoJPochpXY4G0kDjgN4He0MwBSl7u+J/wboFunP1ints4tUPb8hod WcKplbxx8/h1O4udJQlNUwYdt2GT/9oB2es+wgekofjTeDuk07ZB1WLogwD3jMaZrcphEtUky /O+FpuoaJq0na0TAqFVwrDpKy Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We print an error message when platform_device_register_full() fails, but the initialization of the argument has been removed, as shown in this warning: drivers/usb/musb/da8xx.c: In function 'da8xx_probe': drivers/usb/musb/da8xx.c:521:3: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This modifies the function to assign the return code before checking it, and does uses the same method in the check for usb_phy_generic_register() as well. Fixes: 947c49afe41f ("usb: musb: da8xx: Remove mach code") Signed-off-by: Arnd Bergmann --- drivers/usb/musb/da8xx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 2358f636e48c..210b7e43a6fd 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -462,7 +462,6 @@ static int da8xx_probe(struct platform_device *pdev) { struct resource musb_resources[2]; struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct platform_device *musb; struct da8xx_glue *glue; struct platform_device_info pinfo; struct clk *clk; @@ -490,9 +489,10 @@ static int da8xx_probe(struct platform_device *pdev) pdata->platform_ops = &da8xx_ops; glue->usb_phy = usb_phy_generic_register(); - if (IS_ERR(glue->usb_phy)) { + ret = PTR_ERR_OR_ZERO(glue->usb_phy); + if (ret) { dev_err(&pdev->dev, "failed to register usb_phy\n"); - return PTR_ERR(glue->usb_phy); + return ret; } platform_set_drvdata(pdev, glue); @@ -516,14 +516,14 @@ static int da8xx_probe(struct platform_device *pdev) pinfo.data = pdata; pinfo.size_data = sizeof(*pdata); - glue->musb = musb = platform_device_register_full(&pinfo); - if (IS_ERR(musb)) { + glue->musb = platform_device_register_full(&pinfo); + ret = PTR_ERR_OR_ZERO(glue->musb); + if (ret) { dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); usb_phy_generic_unregister(glue->usb_phy); - return PTR_ERR(musb); } - return 0; + return ret; } static int da8xx_remove(struct platform_device *pdev)