Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2013396rwi; Tue, 11 Oct 2022 03:45:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E4gDnAjQq3DxkDfXBFiPD5+0atwnOw2IIJzZnWpcdgFHjaf17JyCDSY0mvMVPK0VrQ4tD X-Received: by 2002:a17:902:8a97:b0:178:1939:c721 with SMTP id p23-20020a1709028a9700b001781939c721mr23889925plo.108.1665485147017; Tue, 11 Oct 2022 03:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665485147; cv=none; d=google.com; s=arc-20160816; b=aZ8wPpJOVm0nJu4SzHjzGKm/AbFHuReQEhYeHDqf7IWbahZtORyheslkuGArYsFgwr gpElwI3XwUbwLrzLydU4rIZi4nLf/uU2BeiO++8R71VDxDNMEgRGTfh7bHXtBcSLZigi RIVWYpLlzRI4HiBo2DOgpCt7re7gQuGfkegzw7ZqsMZRpqxiQxC8KqzhjAzZUIVixDeJ 559neGXFogHO14fu3xm0+8KCtZ2crN7kU1wOZqjkfp0f9W07GAwgbLM0/akD2LUuSC1Z 8DJrpeiCa+EqXXbDLJVLraptQmnT7tVIqVnO43za4BD5piotEnKaOfZV0GVEiwNQRREj ZoZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZLIrvoe+FIF9Rl2LQ64g0umqbuCq3HckpYKCNFCJXoc=; b=QG0Po28C8R8+IqHfX2LwDYtEYzOyfWA1xKV3OSoV/h9zu08QHRjJ0n9hNiUn/lINsU Fs4xe+XLShcocDROykFxPg658RQ07tNps36Ug/5RBaysB9sa9pu7baHrEXsSvsHw3IU6 v6Hl7lish1H/2M3+a/ooY7UIQQ/nhkabLvU9XL4KPGPQwWbbIJtU+6PZOjpJcA+3pinh x16fhPk4QgLRI7Y+p2IWkcZxdCehvSf85vX1pqjFmVAlCRBjBmxO11PpFxgTgTiaNqhG 7cx1q+iVX5R9r5MB7xAqqDUe++ytqNOMSI6Y77FX8zopBgRcaqAiSLRJqaE8xmpd1Tsn 3YYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sucvMSya; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902cec400b00176ab430a57si17209324plg.546.2022.10.11.03.45.35; Tue, 11 Oct 2022 03:45:46 -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=@linaro.org header.s=google header.b=sucvMSya; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229537AbiJKKZT (ORCPT + 99 others); Tue, 11 Oct 2022 06:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbiJKKZR (ORCPT ); Tue, 11 Oct 2022 06:25:17 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 832323FD53 for ; Tue, 11 Oct 2022 03:25:14 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id b2so12777796plc.7 for ; Tue, 11 Oct 2022 03:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZLIrvoe+FIF9Rl2LQ64g0umqbuCq3HckpYKCNFCJXoc=; b=sucvMSyaJJ7WUgAGc9j7CW1DsPdUQM0ZgLA6Vhv2X/TNygbvbQ/7kgQ5ySHNFbeG7+ 3zBAi+kFLvkVdnSqiAh981+9pZmYLzLIJr7w5bX+YiMLm5NyG7ZcMq8dzF99ug6lbDrD pJNwSB01N+F2j4wt3T9yVTUKpXZo3EWOJBTZuJVhuVUPTsf9lzOWg4Q5EJtzSfGkMG9g 0qs0syN8zitlFQyYCkPvTVsg0j8ZQN3c6jsJVMROS1oyeWLWAu3NOoJaNihUhguY+0Br wj6MFdwcKbIu8dgcTmRmhCpdJxvWUy1+bXeJH/c7vXyLWzoRA9SxT9VCM1IaYZAlFFNb bmgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZLIrvoe+FIF9Rl2LQ64g0umqbuCq3HckpYKCNFCJXoc=; b=gxK4GtWik+6noUhvvI81b2UszYX3EcvUDc/SiBUkzCwJPhXGK5FYP4cMBgnvn31kks 1v98CY5eMCzFa0YOJcGNZGCwkkgXO2ILGWK9elZrOYqtwsKxsjFL/J1h1baDWyFKq8nq RINgnPxYmoKquMv0WT9kBTk1YLF6B76axyoeS+eZs1CM3yhUycA5inKC4rCjpFfmcYUs l/bLtI+ju75qoE+vByWhI3EH8j8U4Lb6d6XOoNz3okZm6AqB537FB+tZuoDTNs/urZZx 2XpTds6lpDj89ASpYmd45wHi4oHL6Sij7ykI1D+etYIal5pv9/Wf3dcShT6aSC7vipbG oDew== X-Gm-Message-State: ACrzQf0Bb4dN4aCoQZfkuSBRrUftvtWQ5fmZXtTh8W2qH/gUfoZqcJdv jMaN2Ov8MqPwTyoRB8Gk+DjYKei8vN7+83oZkFNKWQ== X-Received: by 2002:a17:90b:1d8b:b0:20d:30a5:499e with SMTP id pf11-20020a17090b1d8b00b0020d30a5499emr13995274pjb.84.1665483913542; Tue, 11 Oct 2022 03:25:13 -0700 (PDT) MIME-Version: 1.0 References: <0d0ef6651ed44fc780e95c8797294708@hyperstone.com> <65d813c6-65c0-fb5b-2709-8068e1dc89c1@intel.com> In-Reply-To: <65d813c6-65c0-fb5b-2709-8068e1dc89c1@intel.com> From: Ulf Hansson Date: Tue, 11 Oct 2022 12:24:36 +0200 Message-ID: Subject: Re: [PATCHv3 1/2] mmc: block: Remove error check of hw_reset on reset To: =?UTF-8?Q?Christian_L=C3=B6hle?= , Adrian Hunter Cc: Linux MMC List , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Tue, 11 Oct 2022 at 12:15, Adrian Hunter wrote= : > > On 10/10/22 17:03, Christian L=C3=B6hle 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. > > Furthermore ensure part_curr is not falsely set to a valid value > > on reset or partition switch error. > > > > Fixes: fefdd3c91e0a ("mmc: core: Drop superfluous validations in mmc_hw= |sw_reset()") > > Cc: stable@vger.kernel.org > > > > Signed-off-by: Christian Loehle > > --- > > -v3: Ensure invalid part_curr on error > > -v2: Do not attempt to switch partitions if reset failed > > > > drivers/mmc/core/block.c | 29 ++++++++++++++--------------- > > 1 file changed, 14 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > > index ce89611a136e..45a44edcc31a 100644 > > --- a/drivers/mmc/core/block.c > > +++ b/drivers/mmc/core/block.c > > @@ -134,6 +134,7 @@ struct mmc_blk_data { > > * track of the current selected device partition. > > */ > > unsigned int part_curr; > > +#define MMC_BLK_PART_INVALID UINT_MAX /* Unknown partition acti= ve */ > > int area_type; > > > > /* debugfs files (only in main mmc_blk_data) */ > > @@ -991,29 +992,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 =3D dev_get_drvdata(&host->card->dev= ); > > + int part_err; > > > > if (md->reset_done & type) > > return -EEXIST; > > > > md->reset_done |=3D type; > > + main_md->part_curr =3D MMC_BLK_PART_INVALID; > > This forces a partition switch even if it is not necessary. Right, very good point! > > > err =3D mmc_hw_reset(host->card); > > This would be better: > > /* > * A successful reset will leave the card in the main partition, = but > * upon failure it might not be, so set it to MMC_BLK_PART_INVALI= D > * in that case. > */ > main_md->part_curr =3D err ? MMC_BLK_PART_INVALID : main_md->part= _type; > Yes! And the comment is valuable too! [...] Kind regards Uffe