From: "Clément Péron" <peron.clem@gmail.com> To: Rob Herring <robh@kernel.org>, Tomeu Vizoso <tomeu.vizoso@collabora.com>, Steven Price <steven.price@arm.com>, Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>, Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>, Stephen Boyd <sboyd@kernel.org> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Clément Péron" <peron.clem@gmail.com> Subject: [PATCH 1/2] drm/panfrost: missing remove opp table in case of failure Date: Sat, 11 Apr 2020 22:06:31 +0200 [thread overview] Message-ID: <20200411200632.4045-1-peron.clem@gmail.com> (raw) In case of failure we need to remove OPP table. Use Linux classic error handling with goto usage. Signed-off-by: Clément Péron <peron.clem@gmail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..62541f4edd81 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -90,8 +90,11 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) - return PTR_ERR(opp); + if (IS_ERR(opp)) { + DRM_DEV_ERROR(dev, "Failed to set recommended OPP\n"); + ret = PTR_ERR(opp); + goto err_opp; + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); @@ -100,8 +103,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(devfreq); + ret = PTR_ERR(devfreq); + goto err_opp; } pfdev->devfreq.devfreq = devfreq; @@ -112,6 +115,11 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) pfdev->devfreq.cooling = cooling; return 0; + +err_opp: + dev_pm_opp_of_remove_table(dev); + + return ret; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: "Clément Péron" <peron.clem@gmail.com> To: Rob Herring <robh@kernel.org>, Tomeu Vizoso <tomeu.vizoso@collabora.com>, Steven Price <steven.price@arm.com>, Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>, Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>, Stephen Boyd <sboyd@kernel.org> Cc: "Clément Péron" <peron.clem@gmail.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/panfrost: missing remove opp table in case of failure Date: Sat, 11 Apr 2020 22:06:31 +0200 [thread overview] Message-ID: <20200411200632.4045-1-peron.clem@gmail.com> (raw) In case of failure we need to remove OPP table. Use Linux classic error handling with goto usage. Signed-off-by: Clément Péron <peron.clem@gmail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..62541f4edd81 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -90,8 +90,11 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) - return PTR_ERR(opp); + if (IS_ERR(opp)) { + DRM_DEV_ERROR(dev, "Failed to set recommended OPP\n"); + ret = PTR_ERR(opp); + goto err_opp; + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); @@ -100,8 +103,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(devfreq); + ret = PTR_ERR(devfreq); + goto err_opp; } pfdev->devfreq.devfreq = devfreq; @@ -112,6 +115,11 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) pfdev->devfreq.cooling = cooling; return 0; + +err_opp: + dev_pm_opp_of_remove_table(dev); + + return ret; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) -- 2.20.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2020-04-11 20:06 UTC|newest] Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-11 20:06 Clément Péron [this message] 2020-04-11 20:06 ` [PATCH 1/2] drm/panfrost: missing remove opp table in case of failure Clément Péron 2020-04-11 20:06 ` [PATCH 2/2] drm/panfrost: add devfreq regulator support Clément Péron 2020-04-11 20:06 ` Clément Péron 2020-04-13 11:33 ` Clément Péron 2020-04-13 11:33 ` Clément Péron 2020-04-13 13:18 ` Steven Price 2020-04-13 13:18 ` Steven Price 2020-04-13 14:18 ` Clément Péron 2020-04-13 14:18 ` Clément Péron 2020-04-13 14:31 ` Clément Péron 2020-04-13 14:31 ` Clément Péron 2020-04-13 15:55 ` Steven Price 2020-04-13 15:55 ` Steven Price 2020-04-13 16:35 ` Clément Péron 2020-04-13 16:35 ` Clément Péron 2020-04-13 17:28 ` Clément Péron 2020-04-13 17:28 ` Clément Péron 2020-04-14 13:10 ` Steven Price 2020-04-14 13:10 ` Steven Price 2020-04-14 18:20 ` Clément Péron 2020-04-14 18:20 ` Clément Péron 2020-04-14 18:55 ` Mark Brown 2020-04-14 18:55 ` Mark Brown 2020-04-14 19:16 ` Clément Péron 2020-04-14 19:16 ` Clément Péron 2020-04-16 13:42 ` Multiple regulators for one device [was drm/panfrost: add devfreq regulator support] Steven Price 2020-04-16 13:42 ` Steven Price 2020-04-16 14:04 ` Mark Brown 2020-04-16 14:04 ` Mark Brown 2020-04-17 11:10 ` Robin Murphy 2020-04-17 11:10 ` Robin Murphy 2020-04-17 12:33 ` Clément Péron 2020-04-17 12:33 ` Clément Péron 2020-04-19 9:25 ` Clément Péron 2020-04-19 9:25 ` Clément Péron 2020-04-20 12:32 ` Mark Brown 2020-04-20 12:32 ` Mark Brown 2020-04-16 13:44 ` [PATCH 2/2] drm/panfrost: add devfreq regulator support Mark Brown 2020-04-16 13:44 ` Mark Brown 2020-05-02 22:07 ` Clément Péron 2020-05-02 22:07 ` Clément Péron 2020-05-07 14:30 ` Steven Price 2020-05-07 14:30 ` Steven Price 2020-05-09 16:28 ` Clément Péron 2020-05-09 16:28 ` Clément Péron 2020-05-09 19:40 ` Clément Péron 2020-05-09 19:40 ` Clément Péron 2020-04-14 13:09 ` Robin Murphy 2020-04-14 13:09 ` Robin Murphy 2020-04-13 13:07 ` [PATCH 1/2] drm/panfrost: missing remove opp table in case of failure Steven Price 2020-04-13 13:07 ` Steven Price
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200411200632.4045-1-peron.clem@gmail.com \ --to=peron.clem@gmail.com \ --cc=alyssa.rosenzweig@collabora.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=nm@ti.com \ --cc=robh@kernel.org \ --cc=sboyd@kernel.org \ --cc=steven.price@arm.com \ --cc=tomeu.vizoso@collabora.com \ --cc=vireshk@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.