From patchwork Tue Dec 26 11:12:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Liu X-Patchwork-Id: 10133027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0AD8960211 for ; Tue, 26 Dec 2017 11:10:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 027222D0E5 for ; Tue, 26 Dec 2017 11:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB1A52D14C; Tue, 26 Dec 2017 11:10:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 65DB32D0E5 for ; Tue, 26 Dec 2017 11:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qnPwbVQ4l+FdbEOE7EEDaKZxw6UFmXkp6Waiw3ylZXw=; b=apUwxzQKR+T3pos3t69Sm6xZfk Pj9KON3ZsdrpHaw4Vj8iEyevGHw4SqL6xHHERz+hwHh5mF8Qgm2RJgiO7eysJQTQTyotuWJSr6iVz /FEv2bqGB9N0vRa7lq/AJ3Tkcaei8bczwhh7CQ9cKZMeYUYTk0SlqKpN2ElF0giZOZ8qFUf3DIzWq KzT2GlgZ0O9UME5ULP4VC9ocbJAJkmpr8URWebTN0doSx+XF/qphnBAOPNAVH8vc+aj8H1Dc0Fcwr WfsaJc8xp0slELG9roGcK3/+UVSi+k7qLsu5R82L/dgqp+P+3glh/VHwy1dVr/iMGcxl6v+x569Su 1MDDHLIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eTn8A-0005zc-Ox; Tue, 26 Dec 2017 11:10:46 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eTn7j-0005Jv-AJ for linux-arm-kernel@lists.infradead.org; Tue, 26 Dec 2017 11:10:20 +0000 Received: by mail-pl0-x243.google.com with SMTP id i6so17719974plt.13 for ; Tue, 26 Dec 2017 03:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TNPhVuMX2TE519NvPosz1h760/UvuYs9VAa9QM8h5sk=; b=f7rTBYct1JYPH/5hc35UdXQzFKK5VfKUVCzJcN22wRdKdd1CcqfKcqWcZsLnZiSvUd jwMyXoVXxfkU0Ks1ZE0kRYKQm1EPD2ie3x07UBXKxdnKTCUGY4QC6TzLVRkjga/6d4C+ mBjrGVEsRJCXYzoQjutRydnK5brUHjPbI2NxM6pGRwQM8VKU5a8Ov8w3y9oK7TvNYQ9g OF3Vc86dKpdyfJQKgo+8u2BvR3NY7as31g8PWYipDSZhId1ytSYHjtPnONZ06TAY7640 6y6TiGV55QLnCEPSrel6o8yVlNzj8M0YGHq1Rsii9Niq0dY6pRWIrS4/0JKB+7oZbvWa sR2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TNPhVuMX2TE519NvPosz1h760/UvuYs9VAa9QM8h5sk=; b=CSEqxM3zswNUHSrT9bUXQFsiGPA7SaV9zTtemfYRM91MZWOpRNZyPI2HIjecyIKlnM yacmn/cONnpzHXxRuXcjrnz7NkT4rZjMv+xAm/lslx7Tn/Tx5o6qt5WMg8mq+8T3Dc43 hApiA3QUjDXjv4jLjAd+3rtU5v+Ioh+CidzVroMnfcPvis/hFsTNdFUm0qQv8eCTt8Jq rf5f/5UUc2diyk6hdXSliAuI56/pPZ2PLssn5IO/3AP8VBplETTNXfJ34Cmy1FZ6X7O4 MoQcGZwfbeKUBZaRnn40TLAdR7FK9BV/C7GluyBoqoN9s7Ie2YdJHpTCW3ASwSQYh3fP yA3A== X-Gm-Message-State: AKGB3mLjnnPmuHinI+x+Twko4JdwHP6px8LCnjamMnwioVFebOfa1Pxa HBv1b8T+N4nofnt5fQBJFyI= X-Google-Smtp-Source: ACJfBov/uolUIcvlvc9QVKBosq8zVehVPeOZrGRmLIh4eJZiYF2jWL8jOVkBFe9y/6UohI6ugdZUiA== X-Received: by 10.84.130.109 with SMTP id 100mr25603214plc.329.1514286608990; Tue, 26 Dec 2017 03:10:08 -0800 (PST) Received: from 60-242-179-244.static.tpgi.com.au (60-242-179-244.static.tpgi.com.au. [60.242.179.244]) by smtp.gmail.com with ESMTPSA id u68sm58217028pfu.17.2017.12.26.03.10.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Dec 2017 03:10:07 -0800 (PST) From: Jonathan Liu To: Maxime Ripard , David Airlie , Chen-Yu Tsai Subject: [PATCH v2 1/3] drm/sun4i: hdmi: Check for unset best_parent in sun4i_tmds_determine_rate Date: Tue, 26 Dec 2017 22:12:25 +1100 Message-Id: <20171226111227.4526-2-net147@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171226111227.4526-1-net147@gmail.com> References: <20171226111227.4526-1-net147@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171226_031019_434983_35AB9871 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, Jonathan Liu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We should check if the best match has been set before comparing it. 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(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/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 *hw, goto out; } - if (abs(rate - rounded / i) < + if (!best_parent || abs(rate - rounded / i) < abs(rate - best_parent / best_div)) { best_parent = rounded; best_div = i;