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 B8C5EECAAD3 for ; Wed, 31 Aug 2022 15:56:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3CDC10E474; Wed, 31 Aug 2022 15:56:01 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB9C010E469 for ; Wed, 31 Aug 2022 15:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661961356; x=1693497356; h=from:to:subject:in-reply-to:references:date:message-id: mime-version:content-transfer-encoding; bh=6rAuC5KZU13GTNhn2xWFlcXTNQeLRMbSYg1a0MaaXkk=; b=KtOia0gHi+7cePR+nBBcS8pcXacY23Nfcm4GLdLC6PL25Yhq5rvNg03z edn1Ybhi4NwpxCfpvj7v+KO5Ama1PVaHBugWKLFYti4d/5oFnHDYywuX7 sCJU9HmXuQDdz67oglW42MCLpdl7Jni0UN2UZkjdnEPvGS8vG2Xb0lr8M CqpOM1FLOO8XcdyDSudEVchG3FpYZWnx1r+X51Jo6P6y4W7S95DMZUk6q of3RjrSGlfMtv1kKR34+psI7qOQriRcKEjfBpPjEosfIzVhjUAXY1DKz0 rUno1SZJa/+XdbG622bvqGYSP3UUplhoHUohkLZ4aFzBmgRJsmEqoNC9G Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="278495494" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="278495494" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 08:55:56 -0700 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="673406426" Received: from nprotaso-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.43.15]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 08:55:54 -0700 From: Jani Nikula To: Andrzej Hajda , intel-gfx@lists.freedesktop.org In-Reply-To: <3745e576-3c2c-e643-67a5-d84f3a66c3d6@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220830093411.1511040-1-jani.nikula@intel.com> <20220830093411.1511040-2-jani.nikula@intel.com> <3745e576-3c2c-e643-67a5-d84f3a66c3d6@intel.com> Date: Wed, 31 Aug 2022 18:55:46 +0300 Message-ID: <87edwwcsql.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Intel-gfx] [PATCH v2 2/5] drm/i915/dpll: replace BUG_ON() with drm_WARN_ON() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Wed, 31 Aug 2022, Andrzej Hajda wrote: > On 30.08.2022 11:34, Jani Nikula wrote: >> Avoid BUG_ON(). Actually check the dpll count and bail out loudly with >> drm_WARN_ON() from the loop before overflowing >> i915->dpll.shared_dplls[]. >>=20 >> v2: Rebase >>=20 >> Reviewed-by: Ville Syrj=C3=A4l=C3=A4 >> Signed-off-by: Jani Nikula >> --- >> drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >>=20 >> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu= /drm/i915/display/intel_dpll_mgr.c >> index bbe142056c7c..ed267c918009 100644 >> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c >> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c >> @@ -4199,6 +4199,10 @@ void intel_shared_dpll_init(struct drm_i915_priva= te *dev_priv) >> dpll_info =3D dpll_mgr->dpll_info; >>=20=20=20 >> for (i =3D 0; dpll_info[i].name; i++) { >> + if (drm_WARN_ON(&dev_priv->drm, >> + i >=3D ARRAY_SIZE(dev_priv->display.dpll.shared_dplls))) >> + break; >> + > > Shouldn't this check be replaced by some compile time checker. Can't do that because the dpll_info arrays are null terminated. > Anyway: > Reviewed-by: Andrzej Hajda Thanks, but I just pushed the series as Ville already reviewed it. BR, Jani. > > Regards > Andrzej > > >> drm_WARN_ON(&dev_priv->drm, i !=3D dpll_info[i].id); >> dev_priv->display.dpll.shared_dplls[i].info =3D &dpll_info[i]; >> } >> @@ -4206,8 +4210,6 @@ void intel_shared_dpll_init(struct drm_i915_privat= e *dev_priv) >> dev_priv->display.dpll.mgr =3D dpll_mgr; >> dev_priv->display.dpll.num_shared_dpll =3D i; >> mutex_init(&dev_priv->display.dpll.lock); >> - >> - BUG_ON(dev_priv->display.dpll.num_shared_dpll > I915_NUM_PLLS); >> } >>=20=20=20 >> /** > --=20 Jani Nikula, Intel Open Source Graphics Center