From: Josh Durgin Date: Mon, 4 Jun 2012 02:42:23 +0000 (-0700) Subject: librbd: remove useless ENOMEM checks X-Git-Tag: v0.48argonaut~92^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=70686c599bc0040bf7e62deae9af007eca8ca120;p=ceph.git librbd: remove useless ENOMEM checks There will be an exception if memory can't be allocated. Signed-off-by: Josh Durgin --- diff --git a/src/librbd.cc b/src/librbd.cc index a064e013e622..06d282594db2 100644 --- a/src/librbd.cc +++ b/src/librbd.cc @@ -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;