All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@linux.dev>
To: Chanwoo Lee <cw9316.lee@samsung.com>
Cc: shawn.lin@linux.dev, Ulf Hansson <ulfh@kernel.org>,
	"open list:MULTIMEDIA CARD (MMC),
	SECURE DIGITAL (SD) AND..." <linux-mmc@vger.kernel.org>,
	Avri Altman <avri.altman@sandisk.com>,
	Sarthak Garg <quic_sartgarg@quicinc.com>,
	open list <linux-kernel@vger.kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
Subject: Re: [PATCH] mmc: core: sd: Remove unused buffer allocation in sd_enable_cache()
Date: Wed, 3 Jun 2026 17:28:27 +0800	[thread overview]
Message-ID: <9557e06a-bb8e-4c3d-bfab-413af965bd9a@linux.dev> (raw)
In-Reply-To: <20260602094058.358267-1-cw9316.lee@samsung.com>

在 2026/06/02 星期二 17:40, Chanwoo Lee 写道:
> sd_enable_cache() allocates a 512-byte buffer that is never used.
> sd_write_ext_reg() allocates its own internal buffer, and no read-back
> verification is done in this function. Remove the unnecessary allocation.
> 
> Fixes: 130206a615a9 ("mmc: core: Add support for cache ctrl for SD cards")

This cleanup doesn't deserve a fixes tag, otherwise

Reviewed-by: Shawn Lin <shawn.lin@linux.dev>

> Signed-off-by: Chanwoo Lee <cw9316.lee@samsung.com>
> ---
>   drivers/mmc/core/sd.c | 9 +--------
>   1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 948948ca9b4a..c763efb10f64 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1379,15 +1379,10 @@ static int sd_flush_cache(struct mmc_host *host)
>   
>   static int sd_enable_cache(struct mmc_card *card)
>   {
> -	u8 *reg_buf;
>   	int err;
>   
>   	card->ext_perf.feature_enabled &= ~SD_EXT_PERF_CACHE;
>   
> -	reg_buf = kzalloc(512, GFP_KERNEL);
> -	if (!reg_buf)
> -		return -ENOMEM;
> -
>   	/*
>   	 * Set Cache Enable at bit 0 in the performance enhancement register at
>   	 * 260 bytes offset.
> @@ -1397,7 +1392,7 @@ static int sd_enable_cache(struct mmc_card *card)
>   	if (err) {
>   		pr_warn("%s: error %d writing Cache Enable bit\n",
>   			mmc_hostname(card->host), err);
> -		goto out;
> +		return err;
>   	}
>   
>   	err = mmc_poll_for_busy(card, SD_WRITE_EXTR_SINGLE_TIMEOUT_MS, false,
> @@ -1405,8 +1400,6 @@ static int sd_enable_cache(struct mmc_card *card)
>   	if (!err)
>   		card->ext_perf.feature_enabled |= SD_EXT_PERF_CACHE;
>   
> -out:
> -	kfree(reg_buf);
>   	return err;
>   }
>   


      parent reply	other threads:[~2026-06-03  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260602094117epcas1p398765b6fb4a8ee28836cfde89744430f@epcas1p3.samsung.com>
2026-06-02  9:40 ` [PATCH] mmc: core: sd: Remove unused buffer allocation in sd_enable_cache() Chanwoo Lee
2026-06-02  9:59   ` Avri Altman
2026-06-03  9:28   ` Shawn Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9557e06a-bb8e-4c3d-bfab-413af965bd9a@linux.dev \
    --to=shawn.lin@linux.dev \
    --cc=avri.altman@sandisk.com \
    --cc=cw9316.lee@samsung.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=pedrodemargomes@gmail.com \
    --cc=quic_sartgarg@quicinc.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.