[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190309040239.32431-1-kjlu@umn.edu>
Date: Fri, 8 Mar 2019 22:02:39 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Sudeep Holla <sudeep.holla@....com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] firmware: arm_scmi: check return value of idr_find
idr_find may return NULL, so check its return value and return an
error code.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/firmware/arm_scmi/driver.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 8f952f2f1a29..35faa203d549 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -709,6 +709,8 @@ scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev, int prot_id)
if (scmi_mailbox_check(np)) {
cinfo = idr_find(&info->tx_idr, SCMI_PROTOCOL_BASE);
+ if (!cinfo)
+ return -EINVAL;
goto idr_alloc;
}
--
2.17.1
Powered by blists - more mailing lists