]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: fix error handling
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 1 Jul 2017 03:48:37 +0000 (11:48 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 10 Jul 2017 00:45:36 +0000 (08:45 +0800)
get_bucket() does not return a nullptr on error,
it returns a negative error code instead.

Use the IS_ERR() macro to handle it properly.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/crush/CrushWrapper.cc

index 1f4b3f5219348d913d5718039362b75ee51fdd0c..012a065fbdcba3da197b5b001a44bd648e94aa60 100644 (file)
@@ -1596,7 +1596,7 @@ int CrushWrapper::device_class_clone(int original_id, int device_class, int *clo
     return 0;
   }
   crush_bucket *original = get_bucket(original_id);
-  if (original == NULL)
+  if (IS_ERR(original))
     return -ENOENT;
   crush_bucket *copy = crush_make_bucket(crush,
                                         original->alg,