From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5F14441030 for ; Tue, 30 Jun 2026 15:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782833697; cv=none; b=GuMPn1KwA/ihXfg0lAezrUrkOhmcbRZVPKH0N0HCzPA80WtCR3W+B+f5Z17l/fllcXzd8zrXIgDqkYzyoHFNlzdi+wDt0CnarqHf5SB5PMC3O7RZJyxxqdGOuWL+t45TfKyLUL7Bns85d/k9LyqtO+T+4RV1Y4tFQqcINHYnFKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782833697; c=relaxed/simple; bh=lq5f476JObY8Pg8hX2Bh3cHTLWt33Mu4o87uEoga/D8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VRJEzNUi/Bzktm9lSct8ZR7Ltrc033ek/0OlJexKKsBhstyq5yotMVWCZIVB3tEQ5WE0pOY2KfQPtf3SIUNqG6N0lKiAKMFv3/mQsF3m9z38g+hiLv+eoLimGJLeVcxKX1ZqpBazwGh9K/kWtOZzTt1awdm3DwBZGruDQYayB8c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=UXVNuq8D; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="UXVNuq8D" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F2DB2ED2 for ; Tue, 30 Jun 2026 08:34:50 -0700 (PDT) Received: from [192.168.0.1] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CCE903F66F for ; Tue, 30 Jun 2026 08:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782833695; bh=lq5f476JObY8Pg8hX2Bh3cHTLWt33Mu4o87uEoga/D8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UXVNuq8DR+KgqSbYdDUn/2DjSNPPeElsC/smTgGcwBU3gTNB5a+HnApZQVbqROQzQ a1Pqcr4xvvo0DeQsKN39EMRcmYhJNAIdchGG2s1Kr06KplhToOkuqIpZO6dvKuY39+ sclokCPiJ1UxkjUPmTvq7hIqHFntwBzL0SBq2uFE= Date: Tue, 30 Jun 2026 16:34:46 +0100 From: Liviu Dudau To: Gustavo Kenji =?utf-8?B?TWVuZG9uw6dh?= Kaneko Cc: dri-devel@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drm/arm/malidp: use clk_bulk API in runtime PM resume and suspend Message-ID: References: <20260609130812.1065699-1-kaneko.dev@pm.me> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260609130812.1065699-1-kaneko.dev@pm.me> On Tue, Jun 09, 2026 at 01:08:19PM +0000, Gustavo Kenji Mendonça Kaneko wrote: > malidp_runtime_pm_resume() calls clk_prepare_enable() three times > without checking the return value. If any clock fails to enable, the > driver silently proceeds with unclocked hardware, leading to undefined > behavior. > > Convert both the resume and suspend paths to use the clk_bulk API: > clk_bulk_prepare_enable() in resume checks the return value and rolls > back any successfully enabled clocks on failure; > clk_bulk_disable_unprepare() in suspend keeps the two paths symmetric. > > This issue was found by code review without access to Mali DP hardware. > > Signed-off-by: Gustavo Kenji Mendonça Kaneko Sorry for the delay, I've pushed both your patches into drm-misc-fixes today. Best regards, Liviu > --- > Changes in v2: > - Also convert malidp_runtime_pm_suspend() to clk_bulk_disable_unprepare() > to make both paths truly symmetric (Liviu Dudau) > - Drop the incorrect claim about existing clk_bulk usage in the suspend > path from the commit message (Liviu Dudau) > > drivers/gpu/drm/arm/malidp_drv.c | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c > index b765f6c9eea4..90e7f14aacec 100644 > --- a/drivers/gpu/drm/arm/malidp_drv.c > +++ b/drivers/gpu/drm/arm/malidp_drv.c > @@ -670,6 +670,11 @@ static int malidp_runtime_pm_suspend(struct device *dev) > struct drm_device *drm = dev_get_drvdata(dev); > struct malidp_drm *malidp = drm_to_malidp(drm); > struct malidp_hw_device *hwdev = malidp->dev; > + struct clk_bulk_data clks[] = { > + { .clk = hwdev->pclk }, > + { .clk = hwdev->aclk }, > + { .clk = hwdev->mclk }, > + }; > > /* we can only suspend if the hardware is in config mode */ > WARN_ON(!hwdev->hw->in_config_mode(hwdev)); > @@ -677,9 +682,7 @@ static int malidp_runtime_pm_suspend(struct device *dev) > malidp_se_irq_fini(hwdev); > malidp_de_irq_fini(hwdev); > hwdev->pm_suspended = true; > - clk_disable_unprepare(hwdev->mclk); > - clk_disable_unprepare(hwdev->aclk); > - clk_disable_unprepare(hwdev->pclk); > + clk_bulk_disable_unprepare(ARRAY_SIZE(clks), clks); > > return 0; > } > @@ -689,10 +692,17 @@ static int malidp_runtime_pm_resume(struct device *dev) > struct drm_device *drm = dev_get_drvdata(dev); > struct malidp_drm *malidp = drm_to_malidp(drm); > struct malidp_hw_device *hwdev = malidp->dev; > + struct clk_bulk_data clks[] = { > + { .clk = hwdev->pclk }, > + { .clk = hwdev->aclk }, > + { .clk = hwdev->mclk }, > + }; > + int err; > + > + err = clk_bulk_prepare_enable(ARRAY_SIZE(clks), clks); > + if (err) > + return err; > > - clk_prepare_enable(hwdev->pclk); > - clk_prepare_enable(hwdev->aclk); > - clk_prepare_enable(hwdev->mclk); > hwdev->pm_suspended = false; > malidp_de_irq_hw_init(hwdev); > malidp_se_irq_hw_init(hwdev); > -- > 2.54.0 > > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯