From: Lai Jiangshan Date: Fri, 6 Jun 2014 21:37:13 +0000 (-0700) Subject: idr: fix idr_replace()'s returned error code X-Git-Tag: v3.16-rc1~82^2~4^2~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b93804b2fcdb35cc45f95ad77cbe23cc620f6593;p=platform%2Fkernel%2Flinux-exynos.git idr: fix idr_replace()'s returned error code When the smaller id is not found, idr_replace() returns -ENOENT. But when the id is bigger enough, idr_replace() returns -EINVAL, actually there is no difference between these two kinds of ids. These are all unallocated id, the return values of the idr_replace() for these ids should be the same: -ENOENT. Signed-off-by: Lai Jiangshan Acked-by: Tejun Heo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/idr.c b/lib/idr.c index 36ff732..e79e051 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -814,10 +814,10 @@ void *idr_replace(struct idr *idp, void *ptr, int id) p = idp->top; if (!p) - return ERR_PTR(-EINVAL); + return ERR_PTR(-ENOENT); if (id > idr_max(p->layer + 1)) - return ERR_PTR(-EINVAL); + return ERR_PTR(-ENOENT); n = p->layer * IDR_BITS; while ((n > 0) && p) {