From patchwork Thu Mar 22 13:06:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 10301523 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 56597600F6 for ; Thu, 22 Mar 2018 13:09:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4239E2817F for ; Thu, 22 Mar 2018 13:09:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34D91286F9; Thu, 22 Mar 2018 13:09:32 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1587285F2 for ; Thu, 22 Mar 2018 13:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qW8BjfVdGcRjDicyYAJeoeKUXNHoocgjXLN1h0ZS3Bg=; b=Yz/QrxYE8LpKG0 X0YivoY6bguvFJ9llT67MLH1nHIyw/7r2SUMtoWOqtMDjCmnfdD1QeVx5Iog58E3cLxXpQOu/1DZz AkEGdVpn3kujeVrqvySBvAq0k6MWh/0quOfbAZ5CtHPjWaHPNaUHD/1f1Vj392l/8czkwpy/77iiZ 39EMNzZNRCvKN5dpYzXbaTHMZfH37yD2mlzMnzcFZXomRyoy/mWAD+GZau1XuHYa+67AKysdlurRO BHTKjMdLsXJg5us8dSYW3Lbk9OPDCX4qihxjmRGvQCeEj94ECfFjBAlTPSSrC+mljyWEM7DoM9pmc 5mlb1QJMn19qE0APeNNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyzyA-0001uv-Sw; Thu, 22 Mar 2018 13:09:26 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyzwk-0000tA-H7 for linux-arm-kernel@lists.infradead.org; Thu, 22 Mar 2018 13:08:11 +0000 Received: by mail-wr0-x243.google.com with SMTP id s10so8610359wra.13 for ; Thu, 22 Mar 2018 06:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=smlzWBsMeoNxvNMALDbLXY/cu+SyyQJX3YiuFm8IetM=; b=rWIXzTYgCkpqX4mHVlkzOcN3AzdHzhaB05Qr3sVWYmyrVNZ4k6rwBKQ4iKx0a0gFVi XwxKK3gHIymuQhLcxNctEqlA9gS6POtOP1ln9pRmRqtcaxXz+tKO9z5pCE/Lx9lN5Sx7 Za56vxCtDKbjRpOR/t0lu5o37ux8n/W4hJ/5eT06BiQ4llXwzBvfL7DlyDGN9FgtjkMs g1QyhoOXie135SVIyK041HwNpkIrSRDLZDkkox0/uA8Bm0H8C5F1zKUoL/n0d3Mdx+VT JvWpSN2ORlaoi5WxQeFbe7HGgzg2oBpFDREzwVHO8KuFToNPMddjaO4moB+y9NZdD1m+ ZAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=smlzWBsMeoNxvNMALDbLXY/cu+SyyQJX3YiuFm8IetM=; b=Blw9MgoH5uy5o7SriwzY1LA7jx8quPiDcnl0jRNwfK8aYhenpIl0H4vGNSoqVdUFis 6peAS4+cF8lFTPfpadEn3G+e5NCdEGM2TR83SLcqQwNHtC+Gq8cx/pUPRW/I/swAg322 bSMcWa/2sLqpPIRnBJno7gc68q39ChUTIypeNoqiaTZBB8LM9pSdH50Vk86nDI1ehZsG ETSZWYQ/WWTe6tBLJcmuguL5F5oji5YzkJt9b4xVIK/78j7WsuuRBOaGX0uPAgVNzWKd Qh62ogti9R3TVJ24+7dpSKW+RCkLowsJdttMsuFwMRDXhByukQPQ4T97NVH9C7jplztV NZJg== X-Gm-Message-State: AElRT7GYN+gdFLfnV6atbQHxZVtlHAa+vL4yOoahw8BBaKnOqV8U8AT0 Gx90PGhmOAaWq9SrOmhPKyk= X-Google-Smtp-Source: AG47ELspHF9YtPMg9EiaxVvLwU4x4qjORSrpOvVjBguQhLrijL0ICIQ6TYj0GKehSy1JQaavxAJi4A== X-Received: by 10.223.171.79 with SMTP id r15mr2463378wrc.208.1521724066471; Thu, 22 Mar 2018 06:07:46 -0700 (PDT) Received: from cizrna.lan ([109.72.12.73]) by smtp.gmail.com with ESMTPSA id f22sm13800267wmi.39.2018.03.22.06.07.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Mar 2018 06:07:45 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v2] usb: dwc2: dwc2_vbus_supply_init: fix error check Date: Thu, 22 Mar 2018 14:06:39 +0100 Message-Id: <20180322130639.9957-1-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180322093943.49717-1-tomeu.vizoso@collabora.com> References: <20180322093943.49717-1-tomeu.vizoso@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180322_060759_269931_95138F5D X-CRM114-Status: GOOD ( 18.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Amelie Delaunay , Heiko Stuebner , Tomeu Vizoso , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Russell King , Minas Harutyunyan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP devm_regulator_get_optional returns -ENODEV if the regulator isn't there, so if that's the case we have to make sure not to leave -ENODEV in the regulator pointer. Also, make sure we return 0 in that case, but correctly propagate any other errors. Also propagate the error from _dwc2_hcd_start. Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Cc: Amelie Delaunay Signed-off-by: Tomeu Vizoso --- v2: Only overwrite the error in the pointer after checking it (Heiko Stübner ) --- arch/arm/configs/multi_v7_defconfig | 3 +++ drivers/usb/dwc2/hcd.c | 11 +++++++---- scripts/setlocalversion | 9 --------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 846ce7bb24bc..33148fcabd17 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -1029,3 +1029,6 @@ CONFIG_VIRTIO=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_MMIO=y +CONFIG_LOCALVERSION_AUTO=n +CONFIG_LOCALVERSION="" + diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index dcfda5eb4cac..863aed20517f 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -359,8 +359,13 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg) static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) { hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); - if (IS_ERR(hsotg->vbus_supply)) + if (PTR_ERR(hsotg->vbus_supply) == -ENODEV) { + hsotg->vbus_supply = NULL; return 0; + } else if (IS_ERR(hsotg->vbus_supply)) { + hsotg->vbus_supply = NULL; + return PTR_ERR(hsotg->vbus_supply); + } return regulator_enable(hsotg->vbus_supply); } @@ -4342,9 +4347,7 @@ static int _dwc2_hcd_start(struct usb_hcd *hcd) spin_unlock_irqrestore(&hsotg->lock, flags); - dwc2_vbus_supply_init(hsotg); - - return 0; + return dwc2_vbus_supply_init(hsotg); } /* diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 71f39410691b..cbc36d3b4d0f 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -161,15 +161,6 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then # full scm version string res="$res$(scm_version)" -else - # append a plus sign if the repository is not in a clean - # annotated or signed tagged state (as git describe only - # looks at signed or annotated tags - git tag -a/-s) and - # LOCALVERSION= is not specified - if test "${LOCALVERSION+set}" != "set"; then - scm=$(scm_version --short) - res="$res${scm:++}" - fi fi echo "$res"