From patchwork Wed Jun 8 10:27:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 69629 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2414077qgf; Wed, 8 Jun 2016 03:28:02 -0700 (PDT) X-Received: by 10.36.116.17 with SMTP id o17mr10822472itc.35.1465381682144; Wed, 08 Jun 2016 03:28:02 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uo1si795303pac.22.2016.06.08.03.28.01; Wed, 08 Jun 2016 03:28:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424614AbcFHK2A (ORCPT + 3 others); Wed, 8 Jun 2016 06:28:00 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37813 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423210AbcFHK17 (ORCPT ); Wed, 8 Jun 2016 06:27:59 -0400 Received: by mail-wm0-f44.google.com with SMTP id k204so10226133wmk.0 for ; Wed, 08 Jun 2016 03:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6oDwSG28M72ch/GoruFQFX4qA/4/Fu9liSqZ3CWz+dw=; b=g+0r6va0O9qvWDdgCCLKnqI+RP7vRFKUZr8ZGfou6KcxvN7dMDQZLF60DSVTLhSn2Y wCa1eeR8wRiZ2UVKMTNzNJoKizKFPzsiopn+Mf1ZJpDSocvg2vTYpJqtlpoq+aBFjHv7 2B9chbMZlmH3FsDqxDsPZFZEgZSpeEroG8+fw= 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; bh=6oDwSG28M72ch/GoruFQFX4qA/4/Fu9liSqZ3CWz+dw=; b=Z719FDhl6K8RABEQ1/pog+cUJbXcIEK0jQR/xFhPBCGXuQnVsAco9Eawn7FoLX8vJU 1MKl8oABtVO/yDfvRJNTDju3VTAQYz4Y4/OXslbcXbs/ZXi+/U0wGTXBo/wh45v2UQn3 x/5vqmjUKBpyDqpHlU95QUpbMZ4hxGPVD+1LlWFxYISVnLaWqekVTrFyniVjyJeU1yPt B7c4xE6mq2y9s64UeVHSWp2B4amVsfN7r4EG/uJsMTxjyyaOTIDztKw8fq3dUO0rBC1z uTDCWGcpaMn75nD3jN1b5WMJe9mAnZp61dIR1+9LwNtPFSSSx8way1eQPdEVyQPzxblz PM/Q== X-Gm-Message-State: ALyK8tL5fj4DnAZwT/nfKwl1Kd7b23LP2fqcJg+0oy4ZE094Mp8n7nuiAJJKUYpVrZaUQPl4 X-Received: by 10.194.188.116 with SMTP id fz20mr3731670wjc.163.1465381677687; Wed, 08 Jun 2016 03:27:57 -0700 (PDT) Received: from localhost.localdomain (cpc84731-aztw28-2-0-cust112.18-1.cable.virginm.net. [82.37.67.113]) by smtp.gmail.com with ESMTPSA id kc2sm729719wjb.5.2016.06.08.03.27.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 03:27:56 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: peter.griffin@linaro.org, lee.jones@linaro.org, linux-mmc@vger.kernel.org, Chen-Yu Tsai , Arnd Bergmann Subject: [PATCH v2] mmc: core: Only change mode if mmc_select_bus_width() is successful. Date: Wed, 8 Jun 2016 11:27:52 +0100 Message-Id: <1465381672-9772-1-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org mmc_select_bus_width() returns bus width (4 or 8) on success or zero if unsupported. So only change mode if setting the bus width is successful. Fixes f741494 mmc: fix mmc mode selection for HS-DDR and higher Fixes: 287980e (remove lots of IS_ERR_VALUE abuses) Signed-off-by: Peter Griffin Cc: Chen-Yu Tsai Cc: Arnd Bergmann --- v2: Rebase on v4.7-rc2 which includes a fix from Chen-Yu and update commit message. --- drivers/mmc/core/mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5d438ad..aafb73d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card) * switch to HS200 mode if bus width is set successfully. */ err = mmc_select_bus_width(card); - if (err >= 0) { + if (err > 0) { val = EXT_CSD_TIMING_HS200 | card->drive_strength << EXT_CSD_DRV_STR_SHIFT; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, @@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } else if (mmc_card_hs(card)) { /* Select the desired bus width optionally */ err = mmc_select_bus_width(card); - if (err >= 0) { + if (err > 0) { err = mmc_select_hs_ddr(card); if (err) goto free_card;