From patchwork Mon Apr 13 17:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11486897 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 6DB7B14B4 for ; Tue, 14 Apr 2020 07:07:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C34B206E9 for ; Tue, 14 Apr 2020 07:07:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N4jNigDm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C34B206E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84D606E471; Tue, 14 Apr 2020 07:06:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A73889CF8 for ; Mon, 13 Apr 2020 17:33:47 +0000 (UTC) Received: by mail-wm1-x333.google.com with SMTP id z6so10799962wml.2 for ; Mon, 13 Apr 2020 10:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/+Q3sQHWHz/4UUWb+fTY+Lp+S0KWob6RkIjERN3PrL0=; b=N4jNigDmVKSbuGJIYErgx2wKkgof51DDTFYeJrbPeiBoXHbVSgm1rvyddooJwQ9/F7 dBKI4oGUrbpftuKwatusTGfwjFk9ZMDVM8mmcyvVGZZ+oknZ6o5isIBIXgMH/FwLyzIw UiMu0w0GxAf3NaFN6o4WKc+XH6Hwn3pYIc8SHDrinUGFbMtAOeX1FcynrjpjzZcLZxbV fSEl+EmvEwWkGHwBv13UwsrlXU53gllxB1D4d1cQpHLbppZOsu5MIVVdvUaQNXeRmthF 4kl7jdSgOss7MRRe5PJMbqi6UBW2A04Dm5wjyUambqsaaar2P3usG2vYH4Z/C6ktLgxo nWgQ== 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:mime-version :content-transfer-encoding; bh=/+Q3sQHWHz/4UUWb+fTY+Lp+S0KWob6RkIjERN3PrL0=; b=HT0kKwjf7WzI5OqcslFMwU4+b/lxOU1U/lREByKGmsPw8l1xkDgWHDE832QNJZKfkC p0ysBQ5h0+D8Sw7cf8NH2Lusig0+K+gV0D0hvjQlzYApb/6LRa7V+UCTjlOiwMh9hBey DbHU+XjFfw6L85dTuGu+aubKKPX9RyPvij+q/GBizUqmLwvaDncHCVuPxedW4VocCaWy NggYD86DaQYKnVzsKdIlZjUSmfxguoz8bEsgz70lpZ/X48FRv2wJeGZXrsDp5o2tZeQC Co91x8GXaJFLtBeIvdUYP6PqK1xS30Go1Plu/xRiCCpHgim7ktvJTTySeVwuMkZaOWi3 z0wQ== X-Gm-Message-State: AGi0PublF9SH8CxovzkQcU/96Ze06DC6BrUp71nXXNKEqBqG6qu498NB fowyK8uwcEW1k4t4Etbws2c= X-Google-Smtp-Source: APiQypIzdPLyjmPzkX2e19Qkf1kNYWx+TJed6CleG8uZX09mZoberRJIHXFRzVApcauMNo3V2XOI0g== X-Received: by 2002:a1c:6:: with SMTP id 6mr11592040wma.12.1586799225707; Mon, 13 Apr 2020 10:33:45 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:1f1:d0f0::42f0:c285]) by smtp.gmail.com with ESMTPSA id v7sm17025219wmg.3.2020.04.13.10.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 10:33:44 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH v2 1/2] drm/panfrost: missing remove opp table in case of failure Date: Mon, 13 Apr 2020 19:33:37 +0200 Message-Id: <20200413173338.8294-1-peron.clem@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Apr 2020 07:06:18 +0000 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: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In case of failure we need to remove OPP table. Use Linux classic error handling with goto usage. Reviewed-by: Steven Price Signed-off-by: Clément Péron --- 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)