idr_alloc() returns the id allocated or a negative error code. Checking for an error with if (ret) is wrong, check for < 0 instead.
Signed-off-by: Sascha Hauer <[email protected]> --- crypto/public-keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/public-keys.c b/crypto/public-keys.c index 496970cc72..a2d31f4bc2 100644 --- a/crypto/public-keys.c +++ b/crypto/public-keys.c @@ -60,7 +60,7 @@ static int init_public_keys(void) for (iter = __public_keys_start; iter != __public_keys_end; iter++) { ret = idr_alloc(&public_keys, *iter, 0, INT_MAX, GFP_NOWAIT); - if (ret) + if (ret < 0) pr_warn("error while adding key\n"); } -- 2.47.3
