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: 132276 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp822095ljb; Thu, 22 Mar 2018 06:07:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELt1/SA55opuHZ2AY32k06DpchPOB3uRs0O8eb0HXnDLtHkwdGV2euRSUpHcYpAFHET/f9+N X-Received: by 10.99.120.3 with SMTP id t3mr14322525pgc.56.1521724070906; Thu, 22 Mar 2018 06:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521724070; cv=none; d=google.com; s=arc-20160816; b=e4eJA+ElGwGzmiqFcecRU2Oau22Nldxknca5Yvf2c4/sUV7K39pTx2YJltayD2oGqq 8TcTqdBX6jb7zwyNIGlUydUKjttIiuNLolLq3LCZbrEaLNQJKHTevD5L4ZdaENEEyCV4 EiF4RFCEpWS2wHe67maz+H2OLVW128TA7/6PH2HORX4k7BX9f+zl5kk1XV6fupUZ3gkf pRm3ag6MDbCqrR8xO2q1EgBTe2n0dX0UyExdP+0AqN+yCMhobPLU3gSXyHufl7xWxu35 qUdrm03DvO14T3Aus6RT2aHeJHxEc6Amh/JjPitLm2ozJZUOki2whzOtNY8ug6xTPnVI x6Pg== 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=RkFdU68biRWoW0DiSKUQwM8+/VXvGy6UiJpUzJwTZtQ=; b=km4f96wXMLmTV7caJp9IsdrihHQPD5IInxgVLM4laDi9leevl4Me6LfTGQ8eMXi6A4 S15ou/fxpRp9cuFlj9wCzRIY/Iz3wt584njpYDBZ5TmQdDiawN6fyj2Shedj5gE79r/V BTLB/UJ+swMYBCXnFeh4DS6G1vj24FJOs/nv4fgdE9bv+tIzO+TDQiyTsng59LtcR1Sn bhxqlxczNpO7ADFHxeK016ljyMDvLgaitrHol9q/9ld34OpE+lOdfyGNfp/qNMDf2z82 Anaf36mdWsMdDubP1fvQ6jsyUBMDBpIZs1siv+Jvbrfong/rDJRQ7ARwscz3gmP3fyx6 wyyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rWIXzTYg; 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; 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 1-v6si6101419plv.375.2018.03.22.06.07.50; Thu, 22 Mar 2018 06:07:50 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rWIXzTYg; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755295AbeCVNHt (ORCPT + 3 others); Thu, 22 Mar 2018 09:07:49 -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 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@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(-) -- 2.14.3 -- 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/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"