db: move an assignment outside the loop
The "arg" is going to be the same for every iteration so we can move
that assignment outside the loop.
While reviewing it, I decided that having a -1 parameter doesn't make
sense and we would have to lookup the parent_expr to get access to it.
It was easier to return failure on that path.
However, it turned out that the sleep_info was using -1 as a no parameter
option. Which is wrong. -2 is the no parameter option. So let's change
that and still return failure for the -1 case.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>