mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philip Radford <philip.radford@arm.com>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org
Cc: sudeep.holla@arm.com, cristian.marussi@arm.com,
	philip.radford@arm.com, Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap()
Date: Mon, 16 Nov 2026 12:31:52 +0000	[thread overview]
Message-ID: <20261116123153.2672631-2-philip.radford@arm.com> (raw)
In-Reply-To: <20261116123153.2672631-1-philip.radford@arm.com>

Replace switch by setting scmi_shmem_io_ops to use default and only
changing if reg-io-width read suceeds and has a width of 4.

Fixes: 2cd7f3db25fe ("firmware: arm_scmi: Support 'reg-io-width' property for shared memory")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/bug/linux-dd042f6f-0b76-40b8-9435-cbc53370cd08
Signed-off-by: Philip Radford <philip.radford@arm.com>
---
 drivers/firmware/arm_scmi/shmem.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/arm_scmi/shmem.c b/drivers/firmware/arm_scmi/shmem.c
index dadb37557f8a..8a4557a1e5c2 100644
--- a/drivers/firmware/arm_scmi/shmem.c
+++ b/drivers/firmware/arm_scmi/shmem.c
@@ -234,16 +234,11 @@ static void __iomem *shmem_setup_iomap(struct scmi_chan_info *cinfo,
 		dev_err(dev, "failed to ioremap SCMI %s shared memory\n", desc);
 		return IOMEM_ERR_PTR(-EADDRNOTAVAIL);
 	}
+	*ops = &shmem_io_ops_default;
 
-	of_property_read_u32(shmem, "reg-io-width", &reg_io_width);
-	switch (reg_io_width) {
-	case 4:
+	if (!of_property_read_u32(shmem, "reg-io-width", &reg_io_width) &&
+	    reg_io_width == 4)
 		*ops = &shmem_io_ops32;
-		break;
-	default:
-		*ops = &shmem_io_ops_default;
-		break;
-	}
 
 	return addr;
 }
-- 
2.34.1


  reply	other threads:[~2026-11-16 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 12:31 [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Philip Radford
2026-11-16 12:31 ` Philip Radford [this message]
2026-11-16 12:31 ` [PATCH 2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register() Philip Radford
2026-11-19 13:55 ` [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Sudeep Holla
2026-11-19 15:41   ` Philip Radford

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=20261116123153.2672631-2-philip.radford@arm.com \
    --to=philip.radford@arm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sudeep.holla@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®