Received: by 2002:a25:ce4d:0:0:0:0:0 with SMTP id x74csp12009ybe; Thu, 9 Jul 2020 13:44:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfXuaIt1monB65fRF57k54AdR7uzAVe+OkEvjEBDALRMK68jj0M04+5ApEq8JXokkWSq5c X-Received: by 2002:a05:6402:741:: with SMTP id p1mr72809205edy.222.1594327463583; Thu, 09 Jul 2020 13:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594327463; cv=none; d=google.com; s=arc-20160816; b=MCKlScYh/rKk5xCkOjF31hUrt3pdgYhuMb016ztaMGveqh4+MKOI9zQYMAXcdtU0D6 5jAP3hu3nvJUHMlmieaQya7atoM6rHkib9eii+tC5Ruo6GwH/NGI8tvax3hatpzBW7lT y8pYYmjZm09zOkGtYNJe1dmwZJ3lB+bfBbld0jOubFWt/GuAQwdcRtwBEexXMghlHiGo QsLE3o92jc4YgeKvehiL+Ug/DN+q1sjj76k2vWS4P7Cbb0INByJnWOP0sVB10j92we4j D/3Ad/SdVONcnZ3Ufr7rMHozRI6sT2DdBkKb7pvxrV91duwRcZrxToNTyjmMu5CD2TKR 2ixA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d/5Sh4EuXO6ql033nWkgzvXTp8Y4P9jp+RYEe/5wC2w=; b=xIUQ+WjrfRPL3eNZuiCV0/b5b0exYHuFt/5QJTMtm0sf4O3nky4u+pCs26Qmg1n4IB 1pFnJH2xenUbWXMOdmTPuNKeqkuhKJpno/UXMr3PpMJfURrwft4dg3h1vxRUHG4MSR3u cFpjyt+8YjjE4KrP3hT/bv5IWQRG1qtXyeteJf+X/XmA/AsNIN6sxSxYnOAhjtKprXVh xeGV7gaSFaGRbdSRIJ2+c8TuDeRsB0iaL/eTdlp/4nM2ZyLNj+XzNCvAzYQ/Ch++8nr/ txALngaPgz6icjJqdu4XN4mgWI6i+jV0YM6/Ne8whT+Q1Vpzo87/wsI4qABW18zWyvUm kTxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si3446944edl.500.2020.07.09.13.44.00; Thu, 09 Jul 2020 13:44:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726268AbgGIUln (ORCPT + 99 others); Thu, 9 Jul 2020 16:41:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33752 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgGIUln (ORCPT ); Thu, 9 Jul 2020 16:41:43 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 069JVwRT053736; Thu, 9 Jul 2020 15:57:11 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 325p3j6uv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 15:57:10 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 069Jnhkt030215; Thu, 9 Jul 2020 19:57:09 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma03wdc.us.ibm.com with ESMTP id 325k1r0pge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 19:57:09 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 069Jv82L46334234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Jul 2020 19:57:08 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 596B87805F; Thu, 9 Jul 2020 19:57:08 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C906A7805C; Thu, 9 Jul 2020 19:57:07 +0000 (GMT) Received: from ghost4.ibm.com (unknown [9.163.54.227]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 9 Jul 2020 19:57:07 +0000 (GMT) From: Eddie James To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-mmc@vger.kernel.org, andrew@aj.id.au, joel@jms.id.au, ulf.hansson@linaro.org, adrian.hunter@intel.com, sboyd@kernel.org, mturquette@baylibre.com, eajames@linux.ibm.com Subject: [PATCH 2/2] mmc: sdhci-of-aspeed: Fix clock divider calculation Date: Thu, 9 Jul 2020 14:57:06 -0500 Message-Id: <20200709195706.12741-3-eajames@linux.ibm.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200709195706.12741-1-eajames@linux.ibm.com> References: <20200709195706.12741-1-eajames@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-09_10:2020-07-09,2020-07-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=1 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007090131 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When calculating the clock divider, start dividing at 2 instead of 1. The divider is divided by two at the end of the calculation, so starting at 1 may result in a divider of 0, which shouldn't happen. Signed-off-by: Eddie James --- drivers/mmc/host/sdhci-of-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c index 56912e30c47e..a1bcc0f4ba9e 100644 --- a/drivers/mmc/host/sdhci-of-aspeed.c +++ b/drivers/mmc/host/sdhci-of-aspeed.c @@ -68,7 +68,7 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) if (WARN_ON(clock > host->max_clk)) clock = host->max_clk; - for (div = 1; div < 256; div *= 2) { + for (div = 2; div < 256; div *= 2) { if ((parent / div) <= clock) break; } -- 2.24.0