diff options
author | Sage Weil <sage@newdream.net> | 2010-04-01 19:06:19 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:18 -0400 |
commit | a79832f26be370ee26ea81eecdfd42d10e49d66a (patch) | |
tree | 59d55f3c928558505a420830eddfb01b3186d467 /fs/ceph/mon_client.c | |
parent | d52f847a841bfeba0ea87a7842732d388a1ca2e8 (diff) |
ceph: make ceph_msg_new return NULL on failure; clean up, fix callers
Returning ERR_PTR(-ENOMEM) is useless extra work. Return NULL on failure
instead, and fix up the callers (about half of which were wrong anyway).
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mon_client.c')
-rw-r--r-- | fs/ceph/mon_client.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index 5bee9250bf2a..35f593e7e364 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
@@ -490,16 +490,13 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf) | |||
490 | req->buf = buf; | 490 | req->buf = buf; |
491 | init_completion(&req->completion); | 491 | init_completion(&req->completion); |
492 | 492 | ||
493 | err = -ENOMEM; | ||
493 | req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), 0, 0, NULL); | 494 | req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), 0, 0, NULL); |
494 | if (IS_ERR(req->request)) { | 495 | if (!req->request) |
495 | err = PTR_ERR(req->request); | ||
496 | goto out; | 496 | goto out; |
497 | } | ||
498 | req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, 0, 0, NULL); | 497 | req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, 0, 0, NULL); |
499 | if (IS_ERR(req->reply)) { | 498 | if (!req->reply) |
500 | err = PTR_ERR(req->reply); | ||
501 | goto out; | 499 | goto out; |
502 | } | ||
503 | 500 | ||
504 | /* fill out request */ | 501 | /* fill out request */ |
505 | h = req->request->front.iov_base; | 502 | h = req->request->front.iov_base; |
@@ -634,30 +631,22 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) | |||
634 | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; | 631 | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; |
635 | 632 | ||
636 | /* msg pools */ | 633 | /* msg pools */ |
634 | err = -ENOMEM; | ||
637 | monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, | 635 | monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, |
638 | sizeof(struct ceph_mon_subscribe_ack), | 636 | sizeof(struct ceph_mon_subscribe_ack), |
639 | 0, 0, NULL); | 637 | 0, 0, NULL); |
640 | if (IS_ERR(monc->m_subscribe_ack)) { | 638 | if (!monc->m_subscribe_ack) |
641 | err = PTR_ERR(monc->m_subscribe_ack); | ||
642 | monc->m_subscribe_ack = NULL; | ||
643 | goto out_monmap; | 639 | goto out_monmap; |
644 | } | ||
645 | 640 | ||
646 | monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, 0, 0, | 641 | monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, 0, 0, |
647 | NULL); | 642 | NULL); |
648 | if (IS_ERR(monc->m_auth_reply)) { | 643 | if (!monc->m_auth_reply) |
649 | err = PTR_ERR(monc->m_auth_reply); | ||
650 | monc->m_auth_reply = NULL; | ||
651 | goto out_subscribe_ack; | 644 | goto out_subscribe_ack; |
652 | } | ||
653 | 645 | ||
654 | monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, 0, 0, NULL); | 646 | monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, 0, 0, NULL); |
655 | monc->pending_auth = 0; | 647 | monc->pending_auth = 0; |
656 | if (IS_ERR(monc->m_auth)) { | 648 | if (!monc->m_auth) |
657 | err = PTR_ERR(monc->m_auth); | ||
658 | monc->m_auth = NULL; | ||
659 | goto out_auth_reply; | 649 | goto out_auth_reply; |
660 | } | ||
661 | 650 | ||
662 | monc->cur_mon = -1; | 651 | monc->cur_mon = -1; |
663 | monc->hunting = true; | 652 | monc->hunting = true; |