Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754060AbbLXJNK (ORCPT ); Thu, 24 Dec 2015 04:13:10 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:55490 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753771AbbLXJNC (ORCPT ); Thu, 24 Dec 2015 04:13:02 -0500 X-AuditID: cbfee690-f79646d000001316-81-567bb71d4db8 From: =?ks_c_5601-1987?B?wOW/tcH4?= To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: js07.lee@samsung.com, =?ks_c_5601-1987?B?J8DMsaTIoyc=?= References: In-reply-to: Subject: [PATCH] Move the judgement of timeout into mmc_switch_status_error() Date: Thu, 24 Dec 2015 18:13:01 +0900 Message-id: <008f01d13e2b$4a2a3150$de7e93f0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ks_c_5601-1987 Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdE+GmGT4ToXdJIRSNKASQHJjuvtoQAELmdw Content-language: ko X-OriginalArrivalTime: 24 Dec 2015 09:13:01.0441 (UTC) FILETIME=[49E05710:01D13E2B] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWyRsSkQFd2e3WYwbFPUhaXd81hszjyv5/R gcnj8ya5AMYoLpuU1JzMstQifbsErowJTadZCj4LVSw5foyxgXEjTxcjJ4eEgInEpJZtrBC2 mMSFe+vZuhi5OIQEVjBKTD09mw2maM3BU+wQiaWMEj19W8ASQgKTmSQ+/giFsIE63ryPBbHZ BKwl7t28ygRiiwiESnzcuhbMZgayV1xeBtTLAVTPLbG6OQgkzCnAI7HuTycziC0s4CuxbulN RpASFgFViZYVniBhXgFLiV9HJzND2IISPybfY4GYaCDxflYfK4QtL7F5zVtmiJMVJHacfc0I cYGRRN+rV1AXiEjse/GOEeJiFYkJ97axg6ySALrs7XMB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gUEwkVlKNDkfmKby SuINjU3MjCyNzA0tjIzNlcR5ay9FhgkJpCeWpGanphakFsH0MXFwSjUwpog12d51FV209uqe +22SO24lSDWXCW+19FeOfHV2xaczj/YUrJEIYE0+vPSijDbjp7j0Sps6d2blYscH2tviFgnN W8N+9lsGo5KUWWTt+6LInYlSryK5+73tnXkDzrr/uLXs+Ksuu1VXFXX5YzLu/O1fv+zd1+ui Dedv6xY9fv+tk0Uja+MHJZbijERDLeai4kQAA3EXgBsDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2553 Lines: 117 >From bc1e491b29d9199f16c6e002a69f9377677b93af Mon Sep 17 00:00:00 2001 From: "yj84.jang" Date: Wed, 16 Dec 2015 08:52:47 +0900 Subject: [PATCH] Move the judgement of timeout into mmc_switch_status_error() __mmc_switch() is possible to misjudge error. Although jiffies was overed timeout, the chance about "R1_CURRENT_STATE(status) != R1_STATE_PRG" is exists. In other words, Successful completion of CMD6 with timeout error. Kernel expects failure of __mmc_switch, but card is completed CMD6 in this case. It makes mismatch status between mmc subsystem and mmc card. Especially, in case of partition switch, If timeout occurs with normal status of CMD13 response unfortunatley, "main_md->curr" will not be set, even card switched successfully. Checking state of mmc card is needed when judging an timeout error, if it is just timeout or timeout with error. Signed-off-by: yj84.jang --- drivers/mmc/core/mmc_ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 1f44426..033f475 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -456,6 +456,8 @@ int mmc_switch_status_error(struct mmc_host *host, u32 status) if (status & R1_SPI_ILLEGAL_COMMAND) return -EBADMSG; } else { + if (R1_CURRENT_STATE(status) == R1_STATE_PRG) + return -ETIMEDOUT; if (status & 0xFDFFA000) pr_warn("%s: unexpected status %#x after switch\n", mmc_hostname(host), status); @@ -568,8 +570,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, if (time_after(jiffies, timeout)) { pr_err("%s: Card stuck in programming state! %s\n", mmc_hostname(host), __func__); - err = -ETIMEDOUT; - goto out; + break; } } while (R1_CURRENT_STATE(status) == R1_STATE_PRG); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/