From 4cb7d2bbbd8fd97b716e94e644323b3797ead7ad Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Wed, 14 Oct 2020 21:03:25 +0530 Subject: [PATCH] rbd: remove unwanted condition check in flattenCloneImage All the previous condition checks exit from the function and when it reach to this block its obvious that error is non nil, we dont need an extra check here. Signed-off-by: Humble Chirammal --- internal/rbd/clone.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/rbd/clone.go b/internal/rbd/clone.go index 00d39ac36..73a7d924a 100644 --- a/internal/rbd/clone.go +++ b/internal/rbd/clone.go @@ -244,10 +244,8 @@ func (rv *rbdVolume) flattenCloneImage(ctx context.Context) error { if err == nil { return tempClone.flattenRbdImage(ctx, tempClone.conn.Creds, false, hardLimit, softLimit) } - if err != nil { - if !errors.Is(err, ErrImageNotFound) { - return err - } + if !errors.Is(err, ErrImageNotFound) { + return err } return rv.flattenRbdImage(ctx, rv.conn.Creds, false, hardLimit, softLimit) }