Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752822AbeADT5E (ORCPT + 1 other); Thu, 4 Jan 2018 14:57:04 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:57102 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990AbeADT5C (ORCPT ); Thu, 4 Jan 2018 14:57:02 -0500 Date: Thu, 4 Jan 2018 20:56:50 +0100 From: Maxime Ripard To: Jonathan Liu Cc: David Airlie , Chen-Yu Tsai , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v2 1/3] drm/sun4i: hdmi: Check for unset best_parent in sun4i_tmds_determine_rate Message-ID: <20180104195650.vmbooz3pwjy77wt7@flea.lan> References: <20171226111227.4526-1-net147@gmail.com> <20171226111227.4526-2-net147@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xnxcoycj7u4dkg37" Content-Disposition: inline In-Reply-To: <20171226111227.4526-2-net147@gmail.com> User-Agent: NeoMutt/20171208 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --xnxcoycj7u4dkg37 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Dec 26, 2017 at 10:12:25PM +1100, Jonathan Liu wrote: > We should check if the best match has been set before comparing it. >=20 > Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") > Signed-off-by: Jonathan Liu > --- > drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/dr= m/sun4i/sun4i_hdmi_tmds_clk.c > index dc332ea56f6c..4d235e5ea31c 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c > +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c > @@ -102,7 +102,7 @@ static int sun4i_tmds_determine_rate(struct clk_hw *h= w, > goto out; > } > =20 > - if (abs(rate - rounded / i) < > + if (!best_parent || abs(rate - rounded / i) < Why is that causing any issue? If best_parent is set to 0... > abs(rate - best_parent / best_div)) { =2E.. the value returned here is going to be rate, which is going to be higher than the first part of the comparison meaning ... > best_parent =3D rounded; =2E.. that best_parent is going to be set there. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --xnxcoycj7u4dkg37 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlpOhwEACgkQ0rTAlCFN r3SKhBAAlE2GDtJ5qwZez4T3tho/5HRondrckZ1ykDvANu9lRA6NU8E5UV/qdBHI vJTtSL025PVwGpds0TcNLmWCxFbAXZwHMRMRu07FYBpp4kIdewTclLYGt2BBjNWl brehWgFPQaPWBbyYHe2BFook57oHi9e4bksVQ4m8cOflhzvOMGuc5wJMNyU6GaWe zeREdo4R/s/1FsrjCociufYyUrjgrbR9SvL1YyzVdbp35ZNgX8UG8axtWQOn4yuZ /rpFKJehY/hWgzqVzU2tKR4X39WNj1JT6T2G9+l2Fb6TTIrKb2OzJHQWX9b/oKaL QJnQdE/0rbguYy7g26x6OVW2+nlFOag/WwgUNfTEum8T6kMZ/jX20qfXBRtQq9FD 3ZjfhxXehTUSFU7P+k+pKgVpBQdI2VwjNNqbjetDcTSMDy7qFipH0Jhxllid8enC e7VCHY+L/T5A4jGq175OC6TZ12GoeRu0U6zI2DAUn54poasEN3YEB32VhZ6gIHvw Xr+Ac0vxEcPNTCapH1mKKAQ+ftHxpVW4vYtvy2LbU7Op4YnC5vAd/hHA6PRab4Li hfL4vSZxqrZKYSKimRNdlRtrs+3VkZKwVf4fhH5ZVsA4Vdc083TvfpNcxHOR6Ftn 8zSbKrFmaQZOd4JjgZ0lLJV6QAMyH2irz24uA3KOb0TTkDO6/Cc= =fsa2 -----END PGP SIGNATURE----- --xnxcoycj7u4dkg37--