Commit b5dc0ffd authored by Cristian Marussi's avatar Cristian Marussi Committed by Sudeep Holla

firmware: arm_scmi: Use xa_insert() when saving raw queues

Use xa_insert() when saving per-channel raw queues to better check for
duplicates.

Fixes: 7860701d ("firmware: arm_scmi: Add per-channel raw injection support")
Signed-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20240108185050.1628687-2-cristian.marussi@arm.comSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent e8ef4bbe
......@@ -1111,7 +1111,6 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw,
int i;
for (i = 0; i < num_chans; i++) {
void *xret;
struct scmi_raw_queue *q;
q = scmi_raw_queue_init(raw);
......@@ -1120,13 +1119,12 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw,
goto err_xa;
}
xret = xa_store(&raw->chans_q, channels[i], q,
ret = xa_insert(&raw->chans_q, channels[i], q,
GFP_KERNEL);
if (xa_err(xret)) {
if (ret) {
dev_err(dev,
"Fail to allocate Raw queue 0x%02X\n",
channels[i]);
ret = xa_err(xret);
goto err_xa;
}
}
......@@ -1322,6 +1320,12 @@ void scmi_raw_message_report(void *r, struct scmi_xfer *xfer,
dev = raw->handle->dev;
q = scmi_raw_queue_select(raw, idx,
SCMI_XFER_IS_CHAN_SET(xfer) ? chan_id : 0);
if (!q) {
dev_warn(dev,
"RAW[%d] - NO queue for chan 0x%X. Dropping report.\n",
idx, chan_id);
return;
}
/*
* Grab the msg_q_lock upfront to avoid a possible race between
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment