From patchwork Tue Aug 19 11:14:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 4742091 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 290E4C0338 for ; Tue, 19 Aug 2014 11:17:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56BC0200E6 for ; Tue, 19 Aug 2014 11:17:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80A422015A for ; Tue, 19 Aug 2014 11:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753048AbaHSLP6 (ORCPT ); Tue, 19 Aug 2014 07:15:58 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:64720 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbaHSLO5 (ORCPT ); Tue, 19 Aug 2014 07:14:57 -0400 Received: by mail-pd0-f173.google.com with SMTP id w10so9254425pde.18 for ; Tue, 19 Aug 2014 04:14:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZGqKiQ0JyFT9MIwUhG98QIUQeoDd6Sw9WIpW2tUj21w=; b=aq2NPyBSMbcY1blcpasZE8NSFhVYu/b0WcjnK1O47xPAXcZlDngWclj3gDLenyL53r A7/49RAXU148nxco79m+S4u+5irY8S/15hrv/KTRVtbC3rx3c/kINyeTtZE2UR+ZbU05 +1fLTBIfqqdTdE7OrQ8Eu2x6n5kX9BDTsVehPFFvegMmcEL4vk8dZPHft5omcSe/AbL/ dqIMAiU9K152oPdDxkXre197EPHfcJMmLCNziXhh7dWRH6AxuQP/GcefayAk9omQd9FJ CfUhFSbbdU7Ondt7tDJUvd5ZkxZqzyAmiQxTkQ2c8Fk+DNNep0Ks6ABgxU238I6LPUBk 49tw== X-Gm-Message-State: ALoCoQnGiyxNv6zsRkKdgF6bEBO7hg0Ovofzg+/4eF6AhJprRX3gRkWvu9ipnuwa+F78ehWZLLUf X-Received: by 10.66.246.229 with SMTP id xz5mr43453638pac.119.1408446890623; Tue, 19 Aug 2014 04:14:50 -0700 (PDT) Received: from localhost.localdomain ([117.203.126.32]) by mx.google.com with ESMTPSA id h4sm28937920pdi.30.2014.08.19.04.14.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Aug 2014 04:14:49 -0700 (PDT) From: Srinivas Kandagatla To: linux-mmc@vger.kernel.org Cc: Linus Walleij , Chris Ball , Ulf Hansson , Russell King , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v2 2/4] mmc: mmci: move block size validation under relevant code Date: Tue, 19 Aug 2014 12:14:26 +0100 Message-Id: <1408446866-1649-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408446785-1399-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1408446785-1399-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This code moves a BUG_ON condition to relevant if block, this check is not necessary for IPs which can set any arbitrary block size in a given range. This patch is necessary for SDIO which sets block sizes that are exactly not power of 2. Original issue detected while testing WLAN ath6kl on Qualcomm APQ8064 SOC. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 3089fba..1c99195 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -800,15 +800,16 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) writel(timeout, base + MMCIDATATIMER); writel(host->size, base + MMCIDATALENGTH); - blksz_bits = ffs(data->blksz) - 1; - BUG_ON(1 << blksz_bits != data->blksz); - if (variant->blksz_datactrl16) + if (variant->blksz_datactrl16) { datactrl = MCI_DPSM_ENABLE | (data->blksz << 16); - else if (variant->blksz_datactrl4) + } else if (variant->blksz_datactrl4) { datactrl = MCI_DPSM_ENABLE | (data->blksz << 4); - else + } else { + blksz_bits = ffs(data->blksz) - 1; + BUG_ON(1 << blksz_bits != data->blksz); datactrl = MCI_DPSM_ENABLE | blksz_bits << 4; + } if (data->flags & MMC_DATA_READ) datactrl |= MCI_DPSM_DIRECTION;