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 DD1A32EEE86 for ; Fri, 5 Jun 2026 12:17:26 +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=1780661848; cv=none; b=QwtygsNSZ8xb+nrMRnUf4Pmd5Bf18kYQwU//pt/3+1CLyEcxX0JmNjejcwab2QFlpfKb5a04l3WFtQln+pUk8tmoHvcjtVSAEdi8Za1THMO05lkLRy1iPURagGitoLXh40askQsermk9JOCv3sRfelyba0felzCDFMnTxIAn7ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780661848; c=relaxed/simple; bh=n0x8+FGL5EB3lueMGJs2SlV+B6iWu4TkRtDg1ecnhL8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IfQd4m97eu09G7Bd4t70JNsazEu+oCEFHaIq9s9yP3K4Hoy+z2vbpu3vdy67w9VJGfbfA2TvSQqarpDXdzkdajbW3P7THUwAUlMe83oGMLdzT6XVsfgJb5pJed3xVm/0GKE2nZavS4tQ+sGsDR0KRanPr13LBay8faPHqc1fvUc= 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=W3RvUcE7; 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="W3RvUcE7" 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 0E67A4CF9 for ; Fri, 5 Jun 2026 05:17:21 -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 B10A53FB3E for ; Fri, 5 Jun 2026 05:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1780661845; bh=n0x8+FGL5EB3lueMGJs2SlV+B6iWu4TkRtDg1ecnhL8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W3RvUcE7UaRkjJTy6MAb7v6B6M4fAb0RZPv1ViAxwBSz5BHKOHlHNO56bTUCV09bL uH+UwYSB77EVqMrP3cOBG6R2HMqLojQtd2sg+6gEEZ9b6zhoVaiixkbXyNLPGroBIx J6eOdaJAq21F55GygFOyZHXLIL1nMhZF2wgfMl1U= Date: Fri, 5 Jun 2026 13:17:20 +0100 From: Liviu Dudau To: Gustavo Kenji =?utf-8?B?TWVuZG9uw6dh?= Kaneko Cc: dri-devel@lists.freedesktop.org, airlied@gmail.com, simona@ffwll.ch, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] drm/arm/komeda: fix ignored clk_prepare_enable() return value in resume Message-ID: References: <20260531052945.65117-1-kaneko.dev@pm.me> <20260531052945.65117-2-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: <20260531052945.65117-2-kaneko.dev@pm.me> On Sun, May 31, 2026 at 05:30:02AM +0000, Gustavo Kenji Mendonça Kaneko wrote: > komeda_dev_resume() calls clk_prepare_enable() without checking the > return value. If the clock fails to enable, the function returns 0 > (success) while IRQs are enabled and IOMMU is connected on potentially > unclocked hardware, causing undefined behavior on resume. > > Propagate the error from clk_prepare_enable() and return early on > failure to prevent hardware access without a valid clock. > > This issue was found by code review without access to Komeda hardware. Hello, There is nothing wrong with the content of this patch, but I would like if anyone wants to fix these kind of problems to at least be thorough. komeda_dev_suspend() is also ignoring the errors coming from clk_disable_unprepare() and both fuctions before this patch always return 0, so in komeda_drv.c we can sometimes ignore the return value. If we add an extended version of this patch then we should also do proper error handling in komeda_drv.c Best regards, Liviu > > Signed-off-by: Gustavo Kenji Mendonça Kaneko > --- > drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > index 5ba62e637a61..9aad1d1d28ec 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > @@ -313,7 +313,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev) > > int komeda_dev_resume(struct komeda_dev *mdev) > { > - clk_prepare_enable(mdev->aclk); > + int err; > + > + err = clk_prepare_enable(mdev->aclk); > + if (err) > + return err; > > mdev->funcs->enable_irq(mdev); > > -- > 2.54.0 > > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯