From: Jennifer Berringer <jberring@redhat.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Sebastian Reichel <sre@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Maxime Ripard <mripard@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Jennifer Berringer <jberring@redhat.com>
Subject: [PATCH v3 3/3] power: reset: nvmem-reboot-mode: fix write for small cells
Date: Mon, 4 Nov 2024 10:23:12 -0500 [thread overview]
Message-ID: <20241104152312.3813601-4-jberring@redhat.com> (raw)
In-Reply-To: <20241104152312.3813601-1-jberring@redhat.com>
Some devices, such as Qualcomm sa8775p, have an nvmem reboot mode cell
that is smaller than 32 bits, which resulted in
nvmem_reboot_mode_write() failing. Using nvmem_cell_write_variable_u32()
fixes this by writing only the least-significant byte of the magic value
when the size specified in device tree is only one byte.
Signed-off-by: Jennifer Berringer <jberring@redhat.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index 41530b70cfc4..b52eb879d1c1 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -24,7 +24,7 @@ static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot,
nvmem_rbm = container_of(reboot, struct nvmem_reboot_mode, reboot);
- ret = nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic));
+ ret = nvmem_cell_write_variable_u32(nvmem_rbm->cell, magic);
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
--
2.46.2
next prev parent reply other threads:[~2024-11-04 15:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 15:23 [PATCH v3 0/3] nvmem: fix out-of-bounds reboot-mode write Jennifer Berringer
2024-11-04 15:23 ` [PATCH v3 1/3] nvmem: core: improve range check for nvmem_cell_write() Jennifer Berringer
2024-11-04 15:23 ` [PATCH v3 2/3] nvmem: core: add nvmem_cell_write_variable_u32() Jennifer Berringer
2024-12-14 15:07 ` Srinivas Kandagatla
2024-12-20 19:39 ` Jennifer Berringer
2024-12-30 13:50 ` Srinivas Kandagatla
2024-11-04 15:23 ` Jennifer Berringer [this message]
2024-11-11 22:07 ` [PATCH v3 3/3] power: reset: nvmem-reboot-mode: fix write for small cells Sebastian Reichel
2024-12-20 16:48 ` (subset) [PATCH v3 0/3] nvmem: fix out-of-bounds reboot-mode write Srinivas Kandagatla
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=20241104152312.3813601-4-jberring@redhat.com \
--to=jberring@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=sre@kernel.org \
--cc=srinivas.kandagatla@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox