Received: by 10.192.165.148 with SMTP id m20csp4199569imm; Mon, 30 Apr 2018 13:42:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquVUy6PClYxL8g7ZXj0n2Wv1EHC9s3hPvUWS6VmXSu3fb3ncTmxlsoWORD3GxgIQGKU8ee X-Received: by 2002:a17:902:bd0a:: with SMTP id p10-v6mr13871756pls.69.1525120971064; Mon, 30 Apr 2018 13:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525120971; cv=none; d=google.com; s=arc-20160816; b=hJgvovpIP2nZlCVDlE/RJwL+T+s6Y3oVys6zEeP/uz1/1u9es8+mVFBU/2Eq3faNrn BtJ1sZH9laQ3GIcOmSKMdO+uj/G1+GQhoi7d/t5eenUS+Oz9upYiMloOJkQW/F0xGG2x i7GxsyZdyWeyUYkAUb02La7cfcr54SDaSp4zj24yfEP+PUTGsh/JNhl3oevvxWbhaqsK 83imtiU0KESU1a0eF9Z1b1IC2uW9yRHFTwgB7xYV9BkTtN97GvxegUYGNbIEoL8PB+zq m5lplRG41mV+Tmi6UiT5gKPGDD/b2DVu9X2kB1yxJXxnPkOACgDuhPMdWHBiUzBouB/t Q7QA== 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=i5UXxSaSKAUK3mh/kOXxrPLeoIv/6aD7HxKvEGohyHc=; b=IzaZDZZGrNUk2yE6QxnkwBbRbm2k9bvDrx75/U1lgkvoSKIB4MNIMMf7O5BycyJEYm nfA5onyAzRQ3ms3KLMkwbV6EYPm5pVnYA9Lkr3ve8s0Ypg0JDHOv++rsZOMtAHkFFP8q 3oWWzcc+zc3hO1XHv0Pt4doeBGsv1R9Xp7rbJPcy6AMI3m2MXDV8A758nrkxHCUCa5yA dO095mS5oltYD2InBcHLR3ow1t0eZIdvJdEv2vkYdxzEFyxF/mngooeCDgH5eMvp0Ifv 1FKynkgfoWPTnxssTYbMKN5/hZuywu5g9ECpwbSueCHopiFNMFLtEXpj5yN7Y2TL9qZ3 oFjg== 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 k14-v6si6804690pgs.418.2018.04.30.13.42.36; Mon, 30 Apr 2018 13:42:51 -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 S1755359AbeD3UlQ (ORCPT + 99 others); Mon, 30 Apr 2018 16:41:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:57612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159AbeD3TYA (ORCPT ); Mon, 30 Apr 2018 15:24:00 -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 EDDB522DAC; Mon, 30 Apr 2018 19:23:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDDB522DAC 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 3.18 23/25] ASoC: fsl_esai: Fix divisor calculation failure at lower ratio Date: Mon, 30 Apr 2018 12:23:30 -0700 Message-Id: <20180430183911.776436294@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430183910.801976983@linuxfoundation.org> References: <20180430183910.801976983@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 3.18-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;