From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 04635CF34A9 for ; Thu, 3 Oct 2024 14:56:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5260810E188; Thu, 3 Oct 2024 14:56:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="E9vQjEb6"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9947E10E86F for ; Thu, 3 Oct 2024 14:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1727967404; bh=xNB8aA4lwhkIWkbB3SrXYkjCVDmlWQ+HINc2HyZXxy8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=E9vQjEb6DZSHlrpW7fhQwpsHX0Ffb6bXFAImCCaFq0YDIV12Tp1lZW14imXDY/5UF lFzOfG3JJzDfdxe2lkFDYMmuTxIyDvx6Az0t2DgBVAOodUbgaybIo7iZOo9WsEg6/M 5PgfdyL5qEIxmoTPICOJBELh08GIlBGMnshc4aIsGR79tScD7f+v+ulUFAx47pbmGB PTC+D9LNhXrOYen9/WEI43q+CffeZRDqDTTCsbBBoj9BGdsWXFIqc22nNGXYGAxbNJ M/oGMluRWgrmLOdemPG616O4K+pST87PHmS+egIv03wBWzd+2IPyojeAJ3A5l9T7IX 0lgqjrm90HnsQ== Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 995AF17E3600; Thu, 3 Oct 2024 16:56:43 +0200 (CEST) Date: Thu, 3 Oct 2024 16:56:38 +0200 From: Boris Brezillon To: =?UTF-8?B?QWRyacOhbg==?= Larumbe Cc: Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , AngeloGioacchino Del Regno , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] drm/panfrost: Add missing OPP table refcnt decremental Message-ID: <20241003165638.65a2d16e@collabora.com> In-Reply-To: <20241003133037.3398144-1-adrian.larumbe@collabora.com> References: <20241003133037.3398144-1-adrian.larumbe@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, 3 Oct 2024 14:30:28 +0100 Adri=C3=A1n Larumbe wrote: > Commit f11b0417eec2 ("drm/panfrost: Add fdinfo support GPU load metrics") > retrieves the OPP for the maximum device clock frequency, but forgets to > keep the reference count balanced by putting the returned OPP object. This > eventually leads to an OPP core warning when removing the device. >=20 > Fix it by putting OPP objects as many times as they're retrieved. That > includes putting the OPP object in case setting it fails. >=20 > Also remove an unnecessary whitespace. >=20 > Signed-off-by: Adri=C3=A1n Larumbe > Fixes: f11b0417eec2 ("drm/panfrost: Add fdinfo support GPU load metrics") > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/dr= m/panfrost/panfrost_devfreq.c > index 2d30da38c2c3..4b8840a41779 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -38,7 +38,7 @@ static int panfrost_devfreq_target(struct device *dev, = unsigned long *freq, > return PTR_ERR(opp); > dev_pm_opp_put(opp); > =20 > - err =3D dev_pm_opp_set_rate(dev, *freq); > + err =3D dev_pm_opp_set_rate(dev, *freq); > if (!err) > ptdev->pfdevfreq.current_frequency =3D *freq; > =20 > @@ -184,9 +184,12 @@ int panfrost_devfreq_init(struct panfrost_device *pf= dev) > ret =3D dev_pm_opp_set_opp(dev, opp); Put the dev_pm_opp_put(opp) here, and you can drop the one in the error path. > if (ret) { > DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n"); > + dev_pm_opp_put(opp); > return ret; > } > =20 > + dev_pm_opp_put(opp); > + > /* Find the fastest defined rate */ > opp =3D dev_pm_opp_find_freq_floor(dev, &freq); > if (IS_ERR(opp))