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: 9164167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 404E460832 for ; Wed, 8 Jun 2016 10:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3176928345 for ; Wed, 8 Jun 2016 10:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2491628358; Wed, 8 Jun 2016 10:28:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C22C28345 for ; Wed, 8 Jun 2016 10:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424614AbcFHK2A (ORCPT ); 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;