set BUGFIX invalid return value returned
diff --git a/src/set.c b/src/set.c
index a41a2a0..dd37767 100644
--- a/src/set.c
+++ b/src/set.c
@@ -142,7 +142,7 @@
 API LY_ERR
 ly_set_rm_index(struct ly_set *set, unsigned int index)
 {
-    LY_CHECK_ARG_RET(NULL, set, -1);
+    LY_CHECK_ARG_RET(NULL, set, LY_EINVAL);
     LY_CHECK_ERR_RET(((index + 1) > set->number), LOGARG(NULL, set), LY_EINVAL);
 
     if (index == set->number - 1) {