Received: by 10.192.165.148 with SMTP id m20csp4192646imm; Mon, 30 Apr 2018 13:34:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrRLYShXgOYeQ6VNk5Pg+uFX2k9bYi2JCjlsUT+tSjHa4HOxujEwS4Rn/RSg2BkWCA1dDQb X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr13384045plp.136.1525120446570; Mon, 30 Apr 2018 13:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525120446; cv=none; d=google.com; s=arc-20160816; b=GsjpVnh137JWYEbgfvWPRnJNv9BrCYpqVwnZBm1P8nQd3lIwGd/OvQ9a3dOcT3tkO/ hnb7h8Juj3jZtzD1cSid6c6kUz/OuH1MLSN0IMs7QWJAhfO5Q0j9CtwA7TagTF0d0Dht sZwRJRxrRDm/ZHPP8/FhCnJRzNotZrm3yv37BfcE68acCfi0BAwpyTauhxW8dWQFnK1E d/xU1KxdN5Y9j38O3DJqVEprQ6/WaaoK1h5M+eV2RQmk0jGgpnZK2NSPjjPWW7g5Mfwv rL9N22Wdg/qH6B833+N7CCmP3bcUttBPc+CEg7AspEVhz99nGwclRa5pJLotcgIpLWgJ 1Pzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=NcFMQf4mI/PuzrE/SFWHe7khDP0p+vcS4jV3ykOr60U=; b=r9j4GSKHcM1b8ZLvZafxDCq1M6b/qW1X50ED6xNTRAF7JmUHII6ydXTuXShXRiRdc5 m9ujuQlp9QmjjBtBk96ZTc93hl4gyXQfzBPJM+qRZUdaWmOXDMG/oVXVHoPV/ME/ZQBx TUs9nkNAQl+CsWMwvrGz2o3fEa4MifXD8Gru44bnHJK2bbNz+cj1xobMJXAfYWH2je39 ctCEjC4nslWkG5xDabLPjsOUc1YbuxqhUTUjoytVy/46/5HM/ESBbMQ+p/gcIg70s3Gy N1PDptpRAA0wqWa311zWi/vZqHEHgtKDwU0pim0NCojt3WWTyx874RoBol0gEiHIYtZk mysQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y26-v6si357253pgv.202.2018.04.30.13.33.50; Mon, 30 Apr 2018 13:34:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755622AbeD3Uc7 (ORCPT + 99 others); Mon, 30 Apr 2018 16:32:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:59290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755492AbeD3T0E (ORCPT ); Mon, 30 Apr 2018 15:26:04 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A1A7322DC9; Mon, 30 Apr 2018 19:26:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1A7322DC9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Nicolin Chen , Fabio Estevam , Mark Brown Subject: [PATCH 4.4 38/44] ASoC: fsl_esai: Fix divisor calculation failure at lower ratio Date: Mon, 30 Apr 2018 12:24:49 -0700 Message-Id: <20180430190947.851669215@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430190946.093694747@linuxfoundation.org> References: <20180430190946.093694747@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolin Chen commit c656941df9bc80f7ec65b92ca73c42f8b0b62628 upstream. When the desired ratio is less than 256, the savesub (tolerance) in the calculation would become 0. This will then fail the loop- search immediately without reporting any errors. But if the ratio is smaller enough, there is no need to calculate the tolerance because PM divisor alone is enough to get the ratio. So a simple fix could be just to set PM directly instead of going into the loop-search. Reported-by: Marek Vasut Signed-off-by: Nicolin Chen Tested-by: Marek Vasut Reviewed-by: Fabio Estevam Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- sound/soc/fsl/fsl_esai.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -143,6 +143,13 @@ static int fsl_esai_divisor_cal(struct s psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; + /* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */ + if (ratio <= 256) { + pm = ratio; + fp = 1; + goto out; + } + /* Set the max fluctuation -- 0.1% of the max devisor */ savesub = (psr ? 1 : 8) * 256 * maxfp / 1000;