]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: remove useless ENOMEM checks
authorJosh Durgin <josh.durgin@inktank.com>
Mon, 4 Jun 2012 02:42:23 +0000 (19:42 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 8 Jun 2012 21:31:49 +0000 (14:31 -0700)
There will be an exception if memory can't be allocated.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/librbd.cc

index a064e013e62296ffe92a3dd9ac9b9b566c492b59..06d282594db28e57eb195470a76c66c8d965c668 100644 (file)
@@ -1489,8 +1489,6 @@ int open_image(ImageCtx *ictx)
   ictx->data_ctx.snap_set_read(ictx->snapid);
 
   WatchCtx *wctx = new WatchCtx(ictx);
-  if (!wctx)
-    return -ENOMEM;
   ictx->wctx = wctx;
 
   r = ictx->md_ctx.watch(ictx->md_oid(), 0, &(wctx->cookie), wctx);
@@ -2124,8 +2122,6 @@ int RBD::open(IoCtx& io_ctx, Image& image, const char *name)
 int RBD::open(IoCtx& io_ctx, Image& image, const char *name, const char *snapname)
 {
   ImageCtx *ictx = new ImageCtx(name, snapname, io_ctx);
-  if (!ictx)
-    return -ENOMEM;
 
   int r = librbd::open_image(ictx);
   if (r < 0)
@@ -2444,8 +2440,6 @@ extern "C" int rbd_open(rados_ioctx_t p, const char *name, rbd_image_t *image, c
   librados::IoCtx io_ctx;
   librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
   librbd::ImageCtx *ictx = new librbd::ImageCtx(name, snap_name, io_ctx);
-  if (!ictx)
-    return -ENOMEM;
   int r = librbd::open_image(ictx);
   *image = (rbd_image_t)ictx;
   return r;