From patchwork Thu Feb 20 12:57:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 183667 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp544983ile; Thu, 20 Feb 2020 04:59:07 -0800 (PST) X-Google-Smtp-Source: APXvYqy4XKZDHzDZjE+vuZsu1ky0mAqjwBZfRUxY5FYIVQT7gaJ3v35tbsQ+wtDDyuP5f6rMdbTg X-Received: by 2002:a17:902:5a44:: with SMTP id f4mr32087940plm.328.1582203547541; Thu, 20 Feb 2020 04:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582203547; cv=none; d=google.com; s=arc-20160816; b=EudTd06ZKL5Cjr4CPKZDsBgTVOJsQ2DbV9LklULdHbUu6g/ZGdvDtD2RAVckp6lb17 hI4zpq8kPBQpSPxgBpFRenrmcDlHfwyQODN+HJZm7U66KVd/XjI9iagRKDG032ZN813t 2tX8QvLAjahrkkR0TfpXAhLG0QBLa5+RSb8fRK5hPKqrsigS7n66K3LwG+gCwzql4XTm RAL/zPoYePfdEJIk30MzTbr9eMUzucp9F3qBUErM62VIBxKigKxBumBeZw9/j31sOkPB jYsGI74I9TRrAlkFU5u3cZCv6atpZYW2G5qWDOhrZG80ZJBSQ4XXAQVG+jN2M45aZ42b 3meA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:cms-type:message-id:date:subject:to :from:dkim-signature:dkim-filter:delivered-to; bh=LQ/lcsfsBbXe1RAOYLw30d1+eaIaAzMvWa18YKw0+U0=; b=wVM1f6foFTcB43TgxHOW4tv8xoGFbKCg+q1XC2h3k/Jini4/cEH+yNy8Y2ZxMfnljF itoJs1BUEL9GSOVlQzgBujpo3EGYKEhO60kMgFRVMo08hj/tM8Qm/WCb/KL2vXnbGkv0 0K/CSWEpeTRqUFoc7YiYzwt7xYNaPpQD7rFBIQZSaCab7ntoGAfEHwVDEXA4czsbex0F s6MwOYVfNhhe565LVuDvmppzdJtzAl6vWESAHHEMGR8ZjIf0RceaEO7AjelxY3SiLZb7 g3+rZa5XA/SVfcIgbcmUWtBi33btCb5FTXFnljGx1L7c0x7Mp6JASQGxxn9vgFkNB2jF bctA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=ttI43cW5; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id b16si2875655pgs.588.2020.02.20.04.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 04:59:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=ttI43cW5; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0800D6E8DD; Thu, 20 Feb 2020 12:59:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id A86E08862C for ; Thu, 20 Feb 2020 12:59:02 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200220125900euoutp014269e5f539361bdb46b11499d4b73ff2~1HbzJqV5f0533705337euoutp01B for ; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200220125900euoutp014269e5f539361bdb46b11499d4b73ff2~1HbzJqV5f0533705337euoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1582203540; bh=tZrGDaCqzHWhmHLZdoo3aAV9VY8K36ZSu/4KWQRAcjs=; h=From:To:Cc:Subject:Date:References:From; b=ttI43cW539949HGhwbTKCjVs2cniZWb4UKn0xRrZ+BbD/gyNFXRUmi1lhHDAAmNZL ex3atI91oyjuhHe5kmYsJZ4DGW82f41WFPKGEr080Lvn25bqstvFOwnhfaIr5v42aT Hok7a2kw42NDRkKzL/ZLNT+lQ4Ete8+OgE/wWKYU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200220125900eucas1p108d93fb5b79f1f8a380ff03955e297c2~1Hby6-IkA0194901949eucas1p1g; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 24.1B.60698.4928E4E5; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d~1HbydkUQY0196101961eucas1p1R; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200220125900eusmtrp1297724b237974fd3dd718825160ddbdd~1Hbyc0Ua61290212902eusmtrp1Y; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-0c-5e4e82945ae5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 78.87.07950.3928E4E5; Thu, 20 Feb 2020 12:58:59 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200220125859eusmtip1db2444ebb034b0a9c6ee0a8cc550e663~1HbyBB1IH1117411174eusmtip1U; Thu, 20 Feb 2020 12:58:59 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] drm/exynos: hdmi: don't leak enable HDMI_EN regulator if probe fails Date: Thu, 20 Feb 2020 13:57:26 +0100 Message-Id: <20200220125726.19442-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djPc7pTmvziDE6uFrO4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3WLG5JdsDuwe97uPM3n0bVnF6PF5k1wAcxSXTUpqTmZZ apG+XQJXxs7266wFbfIV1zsbWRsYv0l1MXJySAiYSCzZPosVxBYSWMEosXVBBIT9hVHi18SQ LkYuIPszo8T3Y7cZYRpendzCDpFYzijx8dxiNggHqGPPk4tsIFVsAoYSXW+7wGwRATeJpsMz WUGKmAWuM0p8+7GIHSQhLBAucaFhKVARBweLgKpEy3ZTkDCvgC3Qhi9sENvkJVZvOMAM0ish cIBNYlP7fRaIhIvE/pY+JghbWOLV8S3sELaMxOnJPSwQDc2MEg/PrWWHcHoYJS43zYB6wlri zrlfYJuZBTQl1u/Shwg7Sqx/2MwMEpYQ4JO48VYQJMwMZE7aNh0qzCvR0SYEU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P+G/Fc yglJFohq9LzGYaOb1Nj/SDLEWUm54SLbVvf+Hq1DGdszWfWSd1VKX1juuFJU9aiTf/HvJ2Jq jHxXnjw/wMzvXisVWVYU80eKy8PJQNRCiaU4I9FQi7moOBEAuXyN400CAAA= X-CMS-MailID: 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d X-Msg-Generator: CA X-RootMTR: 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Marek Szyprowski MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move enabling and disabling HDMI_EN optional regulator to probe() function to keep track on the regulator status. This fixes following warning if probe() fails (for example when I2C DDC adapter cannot be yet gathered due to the missing driver). This fixes following warning observed on Arndale5250 board with multi_v7_defconfig: [drm] Failed to get ddc i2c adapter by node ------------[ cut here ]------------ WARNING: CPU: 0 PID: 214 at drivers/regulator/core.c:2051 _regulator_put+0x16c/0x184 Modules linked in: ... CPU: 0 PID: 214 Comm: systemd-udevd Not tainted 5.6.0-rc2-next-20200219-00040-g38af1dfafdbb #7570 Hardware name: Samsung Exynos (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0xcc/0xe0) [] (dump_stack) from [] (__warn+0xe0/0xf8) [] (__warn) from [] (warn_slowpath_fmt+0xb0/0xb8) [] (warn_slowpath_fmt) from [] (_regulator_put+0x16c/0x184) [] (_regulator_put) from [] (regulator_put+0x1c/0x2c) [] (regulator_put) from [] (release_nodes+0x17c/0x200) [] (release_nodes) from [] (really_probe+0x10c/0x350) [] (really_probe) from [] (driver_probe_device+0x60/0x1a0) [] (driver_probe_device) from [] (device_driver_attach+0x58/0x60) [] (device_driver_attach) from [] (__driver_attach+0x80/0xbc) [] (__driver_attach) from [] (bus_for_each_dev+0x68/0xb4) [] (bus_for_each_dev) from [] (bus_add_driver+0x130/0x1e8) [] (bus_add_driver) from [] (driver_register+0x78/0x110) [] (driver_register) from [] (exynos_drm_init+0xe8/0x11c [exynosdrm]) [] (exynos_drm_init [exynosdrm]) from [] (do_one_initcall+0x50/0x220) [] (do_one_initcall) from [] (do_init_module+0x60/0x210) [] (do_init_module) from [] (load_module+0x1c0c/0x2310) [] (load_module) from [] (sys_finit_module+0xac/0xbc) [] (sys_finit_module) from [] (ret_fast_syscall+0x0/0x54) Exception stack(0xecca3fa8 to 0xecca3ff0) ... ---[ end trace 276c91214635905c ]--- Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_hdmi.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel Reviewed-by: Andrzej Hajda diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 9ff921f43a93..f141916eade6 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1805,18 +1805,10 @@ static int hdmi_resources_init(struct hdmi_context *hdata) hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); - if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) { + if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) if (IS_ERR(hdata->reg_hdmi_en)) return PTR_ERR(hdata->reg_hdmi_en); - ret = regulator_enable(hdata->reg_hdmi_en); - if (ret) { - DRM_DEV_ERROR(dev, - "failed to enable hdmi-en regulator\n"); - return ret; - } - } - return hdmi_bridge_init(hdata); } @@ -2023,6 +2015,15 @@ static int hdmi_probe(struct platform_device *pdev) } } + if (!IS_ERR(hdata->reg_hdmi_en)) { + ret = regulator_enable(hdata->reg_hdmi_en); + if (ret) { + DRM_DEV_ERROR(dev, + "failed to enable hdmi-en regulator\n"); + goto err_hdmiphy; + } + } + pm_runtime_enable(dev); audio_infoframe = &hdata->audio.infoframe; @@ -2047,7 +2048,8 @@ static int hdmi_probe(struct platform_device *pdev) err_rpm_disable: pm_runtime_disable(dev); - + if (!IS_ERR(hdata->reg_hdmi_en)) + regulator_disable(hdata->reg_hdmi_en); err_hdmiphy: if (hdata->hdmiphy_port) put_device(&hdata->hdmiphy_port->dev);