aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-05-28 11:17:24 +0530
committerStewart Smith <stewart@linux.ibm.com>2019-06-03 10:28:57 +1000
commitfcb1d4dc1b9dd2bd98bdd70bff20f0de33231ee5 (patch)
tree2da880f7a494667c16bc891d89d5eeb711c07bc3 /hw
parentbdcf4483eb55dfa7d4711beb79921720ab661b1c (diff)
downloadskiboot-fcb1d4dc1b9dd2bd98bdd70bff20f0de33231ee5.zip
skiboot-fcb1d4dc1b9dd2bd98bdd70bff20f0de33231ee5.tar.gz
skiboot-fcb1d4dc1b9dd2bd98bdd70bff20f0de33231ee5.tar.bz2
prd: Validate _opal_queue_msg() return value
On safer side, validate _opal_queue_msg() return value. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/prd.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/hw/prd.c b/hw/prd.c
index 9992aec..87e1bae 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -162,6 +162,7 @@ static void send_next_pending_event(void)
{
struct proc_chip *chip;
uint32_t proc;
+ int rc;
uint8_t event;
assert(!prd_msg_inuse);
@@ -182,7 +183,6 @@ static void send_next_pending_event(void)
if (!event)
return;
- prd_msg_inuse = true;
prd_msg->token = 0;
prd_msg->hdr.size = sizeof(*prd_msg);
@@ -211,9 +211,12 @@ static void send_next_pending_event(void)
* We always need to handle PSI interrupts, but if the is PRD is
* disabled then we shouldn't propagate PRD events to the host.
*/
- if (prd_enabled)
- _opal_queue_msg(OPAL_MSG_PRD, prd_msg, prd_msg_consumed,
- prd_msg->hdr.size, prd_msg);
+ if (prd_enabled) {
+ rc = _opal_queue_msg(OPAL_MSG_PRD, prd_msg, prd_msg_consumed,
+ prd_msg->hdr.size, prd_msg);
+ if (!rc)
+ prd_msg_inuse = true;
+ }
}
static void __prd_event(uint32_t proc, uint8_t event)
@@ -420,11 +423,14 @@ static int prd_msg_handle_firmware_req(struct opal_prd_msg *msg)
rc = -ENOSYS;
}
- if (!rc)
+ if (!rc) {
rc = _opal_queue_msg(OPAL_MSG_PRD, prd_msg, prd_msg_consumed,
prd_msg->hdr.size, prd_msg);
- else
+ if (rc)
+ prd_msg_inuse = false;
+ } else {
prd_msg_inuse = false;
+ }
unlock(&events_lock);