Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2080277rwb; Sat, 8 Oct 2022 01:47:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aDMDNlscQXO/FtsmIZ/q4k+FPKFYePCUw3vS1QLL9hl4U9sXOdE0zJQOgJgYg+yPD0fnZ X-Received: by 2002:a63:f103:0:b0:439:398f:80f8 with SMTP id f3-20020a63f103000000b00439398f80f8mr7930737pgi.494.1665218865227; Sat, 08 Oct 2022 01:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665218865; cv=none; d=google.com; s=arc-20160816; b=JNThl2ohGKuOejSuC8dgNvqvD7+vRAEPXiReZGk0t+rO/KurKExzN9qGPWKtcpX0Io tP5wGIc3TUgxI0PpOQnAGwd1YIebAm8SGlxyGTzVR9brVTOvQKxuO0A3WPIs9IKm2Um0 icjumfsj238JXepoeWNXrL/OLABreXElhmEFAd2YYIGRRwR714BBzqv0iobJ2tSo4ito lrpEbL8yRruyz0mKuu2+AukUUmEJciC8SgJNks8KA6ryZkUa+I0/SWtgkK8XGhYW0aTH CYGN9nPnVfR6ehWszDawdFFW/9OFcQn7HY8F7dtd6UKhxdmNdrR7/TifrWnU9Ri8G3Ai JTdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=yo0rKsRFod6gTVZPJSXcj+HA7Ub++BV8HZ5SWDWwoKw=; b=kQHL38Wyi0EhzH+V7W3ceWd09F7xKox6T4oPJhvHbteHdjM/ki54YelchkHPrgBSma Sm2Oj1nQKmsIaqsIwrg2W3pkE4QDo5bS0L8PFV6bRSw3xw7RjA0XyizoZ09azU1mNx64 7eFb46Rnl/1DaxGDkduuwj1M9yWTqXGFgCX4BwkP0Vjd6jvusdRDJoi2nj26et2yhRWf PrNcDNvTOt5Qxf7OHAo1VS+vcLDWZBs5uO4q7eenM9aeNCKlGHDuwJyjzO/Pas5PMkc1 hxxAgpIRrs6IxDYID3awgD3GlbsEblQq084tYfSDB7U3q2mLVCXbTfMAHYonbkBgwqby 5Nyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JVBL9Iks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a170902761600b001783ee34c7csi4260005pll.222.2022.10.08.01.47.14; Sat, 08 Oct 2022 01:47:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JVBL9Iks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbiJHIiN (ORCPT + 99 others); Sat, 8 Oct 2022 04:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiJHIiL (ORCPT ); Sat, 8 Oct 2022 04:38:11 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7BB05508E; Sat, 8 Oct 2022 01:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665218290; x=1696754290; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=4jhk6v/26l2pithB16nJEOXMjX0ZrUns1Vdr5Wp3S+k=; b=JVBL9IksyU+csg5aUHOokhwd/C6UErFqRD9IicxaBpayS4KZqB/zMGo5 ydzPgsPJ0DyMwkupUgP7TNuT2ADWq7HGJx3/81PHCenqTMvYoMA5fvjgd zFZnMdnfIfGRJJJCAV91cEXI2l+854MgZ42fSSTzHDvFNCCYKYOz3VElu oPy0OCQUszJB3h8cQE/LKhWeDkb5KJV8qsX4bKFIVo4t+xrxfXYof6n1c WWO0OKJkSr5nP3QOLY3tOb9vY2UmLs4RDzKjyrpDBl7xL7NbG+cB1gklm shUY/y9iuKsUXhLYnChTzXUEllY5wE8fH/Ve6qC5+s0WYXxVPf1FI8c/Y g==; X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="390214030" X-IronPort-AV: E=Sophos;i="5.95,169,1661842800"; d="scan'208";a="390214030" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2022 01:38:10 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="603151841" X-IronPort-AV: E=Sophos;i="5.95,169,1661842800"; d="scan'208";a="603151841" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.61.77]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2022 01:38:08 -0700 Message-ID: Date: Sat, 8 Oct 2022 11:38:04 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.2.2 Subject: Re: [PATCHv2 1/2] mmc: block: Remove error check of hw_reset on reset To: =?UTF-8?Q?Christian_L=c3=b6hle?= , Ulf Hansson , Linux MMC List , "linux-kernel@vger.kernel.org" References: <003d34d1643242488b533dc14f69830f@hyperstone.com> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <003d34d1643242488b533dc14f69830f@hyperstone.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/10/22 18:42, Christian Löhle wrote: > Before switching back to the right partition in mmc_blk_reset > there used to be a check if hw_reset was even supported. > This return value was removed, so there is no reason to check. > > Fixes: fefdd3c91e0a ("mmc: core: Drop superfluous validations in mmc_hw|sw_reset()") > Cc: stable@vger.kernel.org > > Signed-off-by: Christian Loehle > --- > -v2: Do not attempt to switch partitions if reset failed > > drivers/mmc/core/block.c | 28 +++++++++++++--------------- > 1 file changed, 13 insertions(+), 15 deletions(-) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index ce89611a136e..8db72cba2bbe 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -991,29 +991,27 @@ static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, > int type) > { > int err; > + struct mmc_blk_data *main_md = dev_get_drvdata(&host->card->dev); > + int part_err; > > if (md->reset_done & type) > return -EEXIST; > > md->reset_done |= type; > err = mmc_hw_reset(host->card); > + if (err) > + return err; This could be a potential source of data corruption. There is no guarantee that a subsequent I/O will fail just because the reset failed. Reading / writing the wrong partition would be disastrous, so we should always try to get back to the correct partition. I haven't looked at the possibility of just flagging the partition as invalid - need to be sure any subsequent I/O attempts still go through a path that switches the partition. > /* Ensure we switch back to the correct partition */ > - if (err) { > - struct mmc_blk_data *main_md = > - dev_get_drvdata(&host->card->dev); > - int part_err; > - > - main_md->part_curr = main_md->part_type; > - part_err = mmc_blk_part_switch(host->card, md->part_type); > - if (part_err) { > - /* > - * We have failed to get back into the correct > - * partition, so we need to abort the whole request. > - */ > - return -ENODEV; > - } > + main_md->part_curr = main_md->part_type; > + part_err = mmc_blk_part_switch(host->card, md->part_type); > + if (part_err) { > + /* > + * We have failed to get back into the correct > + * partition, so we need to abort the whole request. > + */ > + return -ENODEV; > } > - return err; > + return 0; > } > > static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type)