All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Santhosh Kumar K <s-k6@ti.com>
Cc: <broonie@kernel.org>,  <xtydtc@gmail.com>,  <vigneshr@ti.com>,
	<linux-spi@vger.kernel.org>,  <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] spi: spi-mem: avoid mutating op template in spi_mem_supports_op()
Date: Thu, 28 May 2026 11:27:36 +0200	[thread overview]
Message-ID: <87h5nrg9yv.fsf@bootlin.com> (raw)
In-Reply-To: <20260527173736.2243004-1-s-k6@ti.com> (Santhosh Kumar K.'s message of "Wed, 27 May 2026 23:07:36 +0530")


> spi_mem_supports_op() accepts a const struct spi_mem_op pointer but
> casts away const internally to call spi_mem_adjust_op_freq(). This
> mutates the caller's op template, which causes stale max_freq values
> when callers reuse persistent templates - subsequent calls won't
> re-apply the device frequency cap since spi_mem_adjust_op_freq()
> skips non-zero values.
>
> Fix by operating on a stack-local copy instead.
>
> Fixes: a4f8e70d75dd ("spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()")
> Cc: Tianyu Xu <xtydtc@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
> ---

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>


  reply	other threads:[~2026-05-28  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 17:37 [PATCH] spi: spi-mem: avoid mutating op template in spi_mem_supports_op() Santhosh Kumar K
2026-05-28  9:27 ` Miquel Raynal [this message]
2026-05-28 12:50 ` Mark Brown

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=87h5nrg9yv.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=s-k6@ti.com \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.com \
    --cc=xtydtc@gmail.com \
    /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.