Check if the dev arg1 is set before calling losetup -d on it. Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> --- common/rc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 18d2ddcf8e35..e7d6801b20e8 100644 --- a/common/rc +++ b/common/rc @@ -4150,7 +4150,10 @@ _create_loop_device() _destroy_loop_device() { local dev=$1 - losetup -d $dev || _fail "Cannot destroy loop device $dev" + + if [ ! -z $dev ]; then + losetup -d $dev || _fail "Cannot destroy loop device $dev" + fi } _scale_fsstress_args() -- 2.39.3