From patchwork Sun Dec 22 17:41:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 11307551 X-Patchwork-Delegate: cw00.choi@samsung.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5176E109A for ; Sun, 22 Dec 2019 17:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25E172070A for ; Sun, 22 Dec 2019 17:41:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mPCxLyET" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbfLVRlg (ORCPT ); Sun, 22 Dec 2019 12:41:36 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40695 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfLVRlg (ORCPT ); Sun, 22 Dec 2019 12:41:36 -0500 Received: by mail-pl1-f195.google.com with SMTP id s21so3543752plr.7; Sun, 22 Dec 2019 09:41:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=GjIArb4hl7a0UGSCX9uBkL4nmbYXvZobEZoJkTTSRZE=; b=mPCxLyETPkbxQhjDoSLsPUtXBpNUwEKEmKVzgnHkA4JnaBUw9M+lvbXtEb0YReHJzT l9J15qZXXxVM2VC27XXsahsfGBCRDuqDDpjHhreb5qzctHmIQULVnWBhI+RiAetpgSrC XSxwVxo1l7JEL0zM9SBC+n2cJSl4PakbOrBBpkdZt7zOzjPgKoSa0A4BlkPJX3lYH/zT LoD2mwynQpO0XKOlsRQKLwlCpiqsJuanDg4131Td4qRhCD9CWw3dQyz+7xYoa9XyN7U4 3nrW7xwYI4zARl/3xWOI71nMSMLqScXF3MAuF7LNA6VGBJWEFZ6BAa6MEgugUlu8tYcZ acSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GjIArb4hl7a0UGSCX9uBkL4nmbYXvZobEZoJkTTSRZE=; b=MrcsqpY2WFGT+YYRRwD2K0LBUKVeEPBqY5p2+f9+DDQ+ArXJExrzTQ1nnONPECUbBi gPEJtHiE71SX2zcyAiKWOLT2DtlzRllEyTw5GwTGH3MPxTvG8PkwwSyVfjYEteafBzHj qm3yi+fsSAzxuTxvPJBwsOAHTgGj/t5bzK2wx5rfXX/GXqmE5g8wfvF6ivxJ9W9FnLm1 +BWhT5IAWof8SRQ4/er/7/TdMNrjoxKGtZ4kOsJ/fKnMH+gXpdoykRJLjvui3S1CqNFh 1opeZM6by/CrmNTBCnPFc1sAkfKAVXXe7yUYsBP6qMvyGRiF5v/SUSlud8qHar/KHb3y 6K3g== X-Gm-Message-State: APjAAAUsAXjYO8Cyj9z+wSMg3exAwvJA1+rxc+f2z1QtkU401GqpLePy 7g9CXVhwBTKz9x6TwgjwdUQ= X-Google-Smtp-Source: APXvYqxWJxGk8wNhQDGsDwCsSuiO1+raKJZgeeqvjiRwYP/0gDQg6gDnZJGz3gr4oLv5qmI2Aww9Rw== X-Received: by 2002:a17:902:9f88:: with SMTP id g8mr27115715plq.100.1577036495552; Sun, 22 Dec 2019 09:41:35 -0800 (PST) Received: from localhost ([2001:19f0:6001:12c8:5400:2ff:fe72:6403]) by smtp.gmail.com with ESMTPSA id i3sm19663100pfo.72.2019.12.22.09.41.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Dec 2019 09:41:34 -0800 (PST) From: Yangtao Li To: cw00.choi@samsung.com, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Yangtao Li Subject: [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails Date: Sun, 22 Dec 2019 17:41:31 +0000 Message-Id: <20191222174132.3701-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The probe process may fail, but the devfreq event device remains enabled. Call devfreq_event_disable_edev on the error return path. Signed-off-by: Yangtao Li --- v2: -change subject -rename lable to err_edev -fix error path handler --- drivers/devfreq/rk3399_dmc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 2f1027c5b647..4288745304c7 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -364,7 +364,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) if (res.a0) { dev_err(dev, "Failed to set dram param: %ld\n", res.a0); - return -EINVAL; + ret = -EINVAL; + goto err_edev; } } } @@ -373,8 +374,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) if (node) { data->regmap_pmu = syscon_node_to_regmap(node); of_node_put(node); - if (IS_ERR(data->regmap_pmu)) - return PTR_ERR(data->regmap_pmu); + if (IS_ERR(data->regmap_pmu)) { + ret = PTR_ERR(data->regmap_pmu); + goto err_edev; + } } regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); @@ -392,7 +395,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) data->odt_dis_freq = data->timing.lpddr4_odt_dis_freq; break; default: - return -EINVAL; + ret = -EINVAL; + goto err_edev; }; arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0, @@ -426,7 +430,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) */ if (dev_pm_opp_of_add_table(dev)) { dev_err(dev, "Invalid operating-points in device tree.\n"); - return -EINVAL; + ret = -EINVAL; + goto err_edev; } of_property_read_u32(np, "upthreshold", @@ -466,6 +471,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) err_free_opp: dev_pm_opp_of_remove_table(&pdev->dev); +err_edev: + devfreq_event_disable_edev(data->edev); return ret; } From patchwork Sun Dec 22 17:41:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 11307557 X-Patchwork-Delegate: cw00.choi@samsung.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F171F109A for ; Sun, 22 Dec 2019 17:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D027F20733 for ; Sun, 22 Dec 2019 17:41:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nn4+Ingb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbfLVRlj (ORCPT ); Sun, 22 Dec 2019 12:41:39 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36656 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfLVRli (ORCPT ); Sun, 22 Dec 2019 12:41:38 -0500 Received: by mail-pl1-f196.google.com with SMTP id a6so5547157plm.3; Sun, 22 Dec 2019 09:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sq1nZxgdVlOFdZ13j/feTQWw6xV90se6Ya+xGUWD2w8=; b=nn4+IngbVUi2MOy8sEb17xGRRJWcWgHlbgkTtGiYKDZSaa8GUNLuJPygCllvkWx0Ii I9xiiujiey6lyACnlOf05QnTH9uQibuyGCT0hspRupDaWSAAM8RtzgBHS6bAsPAAvBcD /ldoOe347ktrCssPFEOsWHL8gR/t1RKAclID8F2Dv2+0E7/c8acpf3dPYvIbFDTgSVR1 olR9wYx/dTOjKNSooNoPc58rtOw3+Gz/5InaKK5+3ybhFUGkTLuhYxa3mJyy9nmlwuT3 37fyYZFCdBFnYZLtmfSDnrMBRg3cxt2KEWR02H7NzWsnR5AEqnhIaxysZ8MuID1Sjrln hONQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sq1nZxgdVlOFdZ13j/feTQWw6xV90se6Ya+xGUWD2w8=; b=MixksT2hRpTGkz0cuWrsin99go1oKsnlxeoRrrms04K7JOczTTj8HTOE9WAuCVXIoy HZeQE739zeaAeEHINvIOtP/E3b9Hiov43lKaZDYX0zZF1IuwojKcqS9/W8woEv4MfPnx wmEPd6+OgGvnfENXJ6YGcLoqgiFIt0g90xLIRhH/sBTBqP7yzWvFuq4jtn+t1ArgfAds 68nPoWuSa66LN2IMKWQlO5vHb+1flSTjIGhcm8fTDT8cqMtDRdrJkTPd0muaMwRnHLXK JuOPEw0B2Ssj2SsEMW1cOHSpHSLocwvqaJBtY9FXRFFKw5bOiC6va3kBMVu7umN7Q0zV zLyg== X-Gm-Message-State: APjAAAX/Qpeg4tb9mA7EFoAG/DRoqBerZfBnOnMo4VWm2X0Qyxq8zsz+ hDghE4A6lnjIX1gaimyrnkGCmXtDeFc= X-Google-Smtp-Source: APXvYqxT5s6ngv8ij7A1pTe1bgYyWS6Z2EYVa48gRLQTHFu8lG8IxBYiOFE+eCCDweL/ZVHdWTx1MA== X-Received: by 2002:a17:902:b407:: with SMTP id x7mr26002206plr.52.1577036497923; Sun, 22 Dec 2019 09:41:37 -0800 (PST) Received: from localhost ([2001:19f0:6001:12c8:5400:2ff:fe72:6403]) by smtp.gmail.com with ESMTPSA id r28sm18703054pgk.39.2019.12.22.09.41.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Dec 2019 09:41:37 -0800 (PST) From: Yangtao Li To: cw00.choi@samsung.com, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Yangtao Li Subject: [PATCH v2 2/2] PM / devfreq: exynos-bus: Disable devfreq-event device when fails Date: Sun, 22 Dec 2019 17:41:32 +0000 Message-Id: <20191222174132.3701-2-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191222174132.3701-1-tiny.windzz@gmail.com> References: <20191222174132.3701-1-tiny.windzz@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The exynos_bus_profile_init process may fail, but the devfreq event device remains enabled. Call devfreq_event_disable_edev on the error return path. Signed-off-by: Yangtao Li --- v2: -change subject -rename lable to err_edev -add return value check --- drivers/devfreq/exynos-bus.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 7f5917d59072..948e9340f91c 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -335,10 +335,17 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, ret = exynos_bus_set_event(bus); if (ret < 0) { dev_err(dev, "failed to set event to devfreq-event devices\n"); - return ret; + goto err_edev; } return 0; + +err_edev: + ret = exynos_bus_disable_edev(bus); + if (ret < 0) + dev_warn(dev, "failed to disable the devfreq-event devices\n"); + + return ret; } static int exynos_bus_profile_init_passive(struct exynos_bus *bus,