2013-03-06 23:01:41

by Suman Anna

[permalink] [raw]
Subject: [PATCH] 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()".

Signed-off-by: Suman Anna <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Ohad Ben-Cohen <[email protected]>
---
drivers/remoteproc/remoteproc_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 29387df..fb0fb34 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -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;
--
1.8.1.2


2013-03-06 23:13:19

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH] remoteproc: fix the error check for idr_alloc

On Wed, Mar 6, 2013 at 2:56 PM, Suman Anna <[email protected]> wrote:
> 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()".
>
> Signed-off-by: Suman Anna <[email protected]>
> Cc: Tejun Heo <[email protected]>
> Cc: Ohad Ben-Cohen <[email protected]>

Acked-by: Tejun Heo <[email protected]>

Sorry about that.

--
tejun

2013-03-17 22:36:25

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH] remoteproc: fix the error check for idr_alloc

On Thu, Mar 7, 2013 at 1:13 AM, Tejun Heo <[email protected]> wrote:
> On Wed, Mar 6, 2013 at 2:56 PM, Suman Anna <[email protected]> wrote:
>> 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()".
>>
>> Signed-off-by: Suman Anna <[email protected]>
>> Cc: Tejun Heo <[email protected]>
>> Cc: Ohad Ben-Cohen <[email protected]>
>
> Acked-by: Tejun Heo <[email protected]>

Thanks Suman, applied to fixes.