Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2654579pxa; Mon, 17 Aug 2020 15:37:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHPehagUp8jpH0pMqIF6ivCBDir0RIAHU51HqYU7m3KdGNLX+zofeRy1B9/bsjtCDI7Dsr X-Received: by 2002:aa7:d293:: with SMTP id w19mr16584005edq.119.1597703878179; Mon, 17 Aug 2020 15:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703878; cv=none; d=google.com; s=arc-20160816; b=SfcZ0QKHBYq3RwM4ZpBSG1HvT5clxKBwpdSliaVvuiNHnTI5Db6m9EAsd0fCM3VdMD huv+gEfMYUUl4Mcg91J0V70XNcxBY1l8h0EMDIA8J5Ke6YNRj1kzlMLYsq7Z0WrvVtxi BiazEjZgjWUjB178xyIwUzS8wVhSUS1otQpyX3UYr8PZQg08lZZ6nYTh1zG8AhAI9m9z fhONFjXykzFRIplLyenGiQLt1B3IhEXoHFv0o4lM/lyVGNPwsbK+I7UpqIUrSBvDbgiD MncvIh3W5wbtcgYVO6TFg5l6hVBWJXPUQC8P9u3EmsziRxJet6+renoqHWC2ORRQtEr6 i/Gg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uctKueUtpMz0LabE3MXacWmPXwoEvn5rI0nsUUDDHXA=; b=dEbrAbPvNFBZk8xaVsT6h9i58n/ow2kDtI9kjyXoIeC51SHM0gi/HY644TwFIIW7Gc 76j2gB5rPhX/upCvxF9Dl9eYOpyUO3LYDXZ8X8S0GxhtEBgqLwHblBlLnX5B+vNp8/he E3G1yDWnloXlcp2+4m7NZnDPg9RZ/1/elUB8VRqLTUdtAUcbFsdR/kzH+95rwDFYOhoz 3lNGWGYi7GMTa1w8Hb3buTV9NSL42bTs/Keu5mDTJNFF7eaCySqM/QbgYfUbzdZ9Gjol 9kV1YweJFp3a2yUuRACKIyT+8kSYzY5PY2JS9db7H0CaAnp8xNMps7IDBnuhHeet9nmz HFNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCDg7PbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si11857410edr.459.2020.08.17.15.37.35; Mon, 17 Aug 2020 15:37:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCDg7PbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389595AbgHQRpE (ORCPT + 99 others); Mon, 17 Aug 2020 13:45:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:50286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388792AbgHQQOd (ORCPT ); Mon, 17 Aug 2020 12:14:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A61920578; Mon, 17 Aug 2020 16:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680872; bh=5KGiXZqA0KWzec0awu2qfq/1IAew9sXfSH80X8CoOmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCDg7PbMACvPDIRHX95LklEsNV+DNEy6a/h1AUxoM28YGs7W8eN6BTqEeIXhYdGTF bFXFVhDqqZO/etub3+nzPJnuzgmwjoHA9rMILN4pPMIxj5o8YDjc7a9m0nFhz6lcvo 0vwYqUcW/iOFG2mQ347bYntIyFayhlL0a8UTTs8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Felsch , Philipp Zabel , Sasha Levin Subject: [PATCH 4.19 091/168] drm/imx: tve: fix regulator_disable error path Date: Mon, 17 Aug 2020 17:17:02 +0200 Message-Id: <20200817143738.256178488@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Marco Felsch [ Upstream commit 7bb58b987fee26da2a1665c01033022624986b7c ] Add missing regulator_disable() as devm_action to avoid dedicated unbind() callback and fix the missing error handling. Fixes: fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)") Signed-off-by: Marco Felsch Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/gpu/drm/imx/imx-tve.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c index cffd3310240e5..c19c1dfbfcdc4 100644 --- a/drivers/gpu/drm/imx/imx-tve.c +++ b/drivers/gpu/drm/imx/imx-tve.c @@ -498,6 +498,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) return 0; } +static void imx_tve_disable_regulator(void *data) +{ + struct imx_tve *tve = data; + + regulator_disable(tve->dac_reg); +} + static bool imx_tve_readable_reg(struct device *dev, unsigned int reg) { return (reg % 4 == 0) && (reg <= 0xdc); @@ -622,6 +629,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) ret = regulator_enable(tve->dac_reg); if (ret) return ret; + ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve); + if (ret) + return ret; } tve->clk = devm_clk_get(dev, "tve"); @@ -668,18 +678,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) return 0; } -static void imx_tve_unbind(struct device *dev, struct device *master, - void *data) -{ - struct imx_tve *tve = dev_get_drvdata(dev); - - if (!IS_ERR(tve->dac_reg)) - regulator_disable(tve->dac_reg); -} - static const struct component_ops imx_tve_ops = { .bind = imx_tve_bind, - .unbind = imx_tve_unbind, }; static int imx_tve_probe(struct platform_device *pdev) -- 2.25.1