Skip to contentSkip to conversation

remoteproc: fix the error check for idr_alloc

PATCH In review Suman Anna 3 participants 3 messages Mar 6, 2013 – Mar 17, 2013 Remote processor (remoteproc)

lore
Share & tools
lore

Suman Anna

author
#0 lore raw

PATCH 1/1 remoteproc: fix the error check for idr_alloc

The new idr_alloc interface returns the allocated id back on success, so fix the error path to check for negative values. This was missed out in the newer idr interface adoption patch, 15fc611 "remoteproc: convert to idr_alloc()".

Cc Tejun Heo <[email protected]>
Cc Ohad Ben-Cohen <[email protected]>
---
 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +1 -1
index 29387df..fb0fb34 100644
@@ -217,7 +217,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
 	 * TODO: support predefined notifyids (via resource table)
 	 */
 	ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL);
-	if (ret) {
+	if (ret < 0) {
 		dev_err(dev, "idr_alloc failed: %d\n", ret);
 		dma_free_coherent(dev->parent, size, va, dma);
 		return ret;
Signature · 1 line
1.8.1.2
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Suman Anna

The new idr_alloc interface returns the allocated id back on success, so fix the error path to check for negative values. This was missed out in the newer idr interface adoption patch, 15fc611 "remoteproc: convert to idr_alloc()".

Cc Tejun Heo <[email protected]>
Cc Ohad Ben-Cohen <[email protected]>

Sorry about that.

Signature · 1 line
tejun
#2 lore raw
Quoted 11 lines · Tejun Heo
Quoted 8 lines · Suman Anna

The new idr_alloc interface returns the allocated id back on success, so fix the error path to check for negative values. This was missed out in the newer idr interface adoption patch, 15fc611 "remoteproc: convert to idr_alloc()".

Cc Tejun Heo <[email protected]>
Cc Ohad Ben-Cohen <[email protected]>

Thanks Suman, applied to fixes.