From patchwork Sat Apr 11 20:06:31 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: 11485339 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 2A124174A for ; Mon, 13 Apr 2020 09:29:42 +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 088062063A for ; Mon, 13 Apr 2020 09:29:42 +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="pN0e9wGO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 088062063A 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 A1A476E419; Mon, 13 Apr 2020 09:29:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B3656E0E3 for ; Sat, 11 Apr 2020 20:06:47 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id o81so131963wmo.2 for ; Sat, 11 Apr 2020 13:06:46 -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=d/xeNUbJ170Rcks+8UPitiY+D8+oYUtGYjLPuwDIIMo=; b=pN0e9wGO3ZParlDyJdUgG4KPLkAkUE96VGull5/Xg47pWLrV50uqu0XeFtOOS9oB8u fBIvinRcku6msWIw7B/AMKi+0LCqk+Ns4xlEZamjwMFXLL9QSUDW6ytBAEZQBFXHI5on z8Yj6U87jwE6nEbVHCzuwVgNK1k2TmaslfzJYIkK46+OpDwXIl+zTYnk2Odcp632qAN6 QjWwgMdKuIwQL2Dncj50HHxFaJDxiiub/Tgle6VEBEOpfymnW5vcLf4MDq1RetwkVVlt PErPBYXk+zMfMwQDtTZW4oaZ/T3FUPwZI8t9fpfUsYHO2XjvlOGkaNoKKsc03AN26rzo btaA== 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=d/xeNUbJ170Rcks+8UPitiY+D8+oYUtGYjLPuwDIIMo=; b=Un+sGeuWuGcOIbsFAYMrgStjMD0ujt9cx2+wn19X8MdcrajujcwtBeNR2HnH5Fr4cE yJTtfW8w81WNfQHniDa4F2XIV5FRVmE2ATdl/qOiVO9ZePcNqm9ktk7OZelcfakwqBip uhd1tqXaTTbe/qiJix6t323WzBjcdmQiwRwskVYmvw9p4iFT1Ekxc+e0kYpaFtrPnQCa 9RTK8PnNpHKwIO/4ThxxOAzRvyDbEew65pnLd9Ydg+c30yn3kevEYWDsVxCt4Q4nbzBl CBokJekFoZYjOcVmL/+6q09t0+L7oHkCDsdgs7893p4FnCHg4HjflzifYjD7UgqvDIeU Rw4g== X-Gm-Message-State: AGi0PuaEl1H/MYBwFUChAK6GJMNZAa0GjgtTYLh97y1d9N97RW+fQqvt oxjhH2A/OCcozCLJM9BB+SU= X-Google-Smtp-Source: APiQypJiMElfxuS7xS/9PX6Fd45JEGZqUGPugBtGCjW8LaAD3OS3TMVizEGgTcv3ItEf4SBPhSxUkQ== X-Received: by 2002:a1c:1bcb:: with SMTP id b194mr11698336wmb.4.1586635605589; Sat, 11 Apr 2020 13:06:45 -0700 (PDT) Received: from localhost.localdomain (91-167-199-67.subs.proxad.net. [91.167.199.67]) by smtp.gmail.com with ESMTPSA id y5sm8712670wru.15.2020.04.11.13.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2020 13:06: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 1/2] drm/panfrost: missing remove opp table in case of failure Date: Sat, 11 Apr 2020 22:06:31 +0200 Message-Id: <20200411200632.4045-1-peron.clem@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 13 Apr 2020 09:29:25 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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)