Received: by 10.213.65.68 with SMTP id h4csp669679imn; Thu, 22 Mar 2018 06:09:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELtoyaAFDIkNlYvEKDhc0UkoALCq24S38uknuLsQp5BEkyw/Z4kLge0KQmgr5CFgA1Ff5bKD X-Received: by 10.98.220.86 with SMTP id t83mr9172633pfg.60.1521724187442; Thu, 22 Mar 2018 06:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521724187; cv=none; d=google.com; s=arc-20160816; b=bPQZ+O8u0L+2xy0AX1KN9LRyIdGNLHkSHNPsUAjrfCZz5sepHW+6WIThYFJ6ih8YOf e6ilP0gHQ8zgP0F1lO9KQQfaAufj2Udu6BU6NEKOvsVD1nxklAQvsxNOEcKcZFqd8g5+ 934SfvO0Yub+wOlPorA6Mvaine1rUIPgOtl+H86UXaMRU6JD46oxCfM3ktx/wJPdNHyo 9/dRV+NNf/2ZQGpQUgsU9x0yeTn7/Gh83zivnBllbqL5Z4CbJ+aoVeklBOtZeF6OfyD9 f6JsN2Htr4fe/T7p8yobR9GnDZVH/kfRiyt3FgsDVgKdzvRd6RUvLyxP0VvE9+/6u1Hm z0SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=smlzWBsMeoNxvNMALDbLXY/cu+SyyQJX3YiuFm8IetM=; b=OCTYu3AIhrD4r7WHS/pwnM0N3GRk26CPWqxXAu3zjd2Che/DcS49SifAMlWwT/eaUD +btVmcvZivc60BjoZ6sp842sluza7WDBFrjIXKb1ydiwN4/EpjHS/k4+GyeuJDKQulbw lERc68je2HAWKg39e/jwmoXTZQPXnTXjUPGGhpAJC9f5mdnC/hdmbkT+NuXj6L9vXWXC lSE5VqlOrt3Bg0K3/Qyrvl0z2ZcU0nHuMGwLkvTCpLGJUUVvDADvTQGuV4oc1Ln9PANU qKppoHm/WpX8hel4IlTKN0qWuWmJkTRQdAJPhule7Nazbucer5PxW2Oa/tfc+pIWV1YU oEsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rWIXzTYg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si6161158ply.528.2018.03.22.06.09.32; Thu, 22 Mar 2018 06:09:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rWIXzTYg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755333AbeCVNHu (ORCPT + 99 others); Thu, 22 Mar 2018 09:07:50 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33516 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755115AbeCVNHs (ORCPT ); Thu, 22 Mar 2018 09:07:48 -0400 Received: by mail-wr0-f195.google.com with SMTP id z73so8634407wrb.0; 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=CNEes2UgluZ82iIGh+NK1blujQn0d7Y/W6pJx/tDoOdL2QM/+w0aSzb3kWHFnvrTxA Rzn+kTHjvyBsuonjZ2bhCUfGoX8dAdGE3dqgRFmw1Dmfd1BvrJ+mJAJOZ2DHMea0ybuq DkqPyoh/YqJ157IrClKVt2gpxwrImU9B0myV3iHMdECiuh3LELtCwuHyI0PneUZbmrU/ iXrFNW0StDHEu99VImh/PvuPwzuNw4LPLOSDWQ40HH5XtjFiwGLLw6s40HcmfS03OFN6 bSRHgTPcnyR+rBli/eME/0eY+JpcSaxt/2o9958OPa5Ec0iyB10N0oUrpVvZTFZnAHEe i5XQ== X-Gm-Message-State: AElRT7FjtpZi+c7lrYuF4+0UzWBmdTemXiHI8BtdSBzea2xnA3pVPYEE gqQJNDYbHan/RCejhmK5TWQZEYM8 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 Cc: Felipe Balbi , Heiko Stuebner , Tomeu Vizoso , Amelie Delaunay , Russell King , Minas Harutyunyan , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" -- 2.14.3