lkml.org 
[lkml]   [2016]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 11/15] md-cluster: Delete four error messages for a failed memory allocation
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Sat, 1 Oct 2016 13:46:20 +0200

    Omit extra messages for a memory allocation failure in three functions.

    Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/md/md-cluster.c | 16 ++++------------
    1 file changed, 4 insertions(+), 12 deletions(-)

    diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
    index b91b552..7f82c6b 100644
    --- a/drivers/md/md-cluster.c
    +++ b/drivers/md/md-cluster.c
    @@ -200,17 +200,13 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
    res->mode = DLM_LOCK_IV;
    namelen = strlen(name);
    res->name = kzalloc(namelen + 1, GFP_KERNEL);
    - if (!res->name) {
    - pr_err("md-cluster: Unable to allocate resource name for resource %s\n", name);
    + if (!res->name)
    goto out_err;
    - }
    strlcpy(res->name, name, namelen + 1);
    if (with_lvb) {
    res->lksb.sb_lvbptr = kzalloc(LVB_SIZE, GFP_KERNEL);
    - if (!res->lksb.sb_lvbptr) {
    - pr_err("md-cluster: Unable to allocate LVB for resource %s\n", name);
    + if (!res->lksb.sb_lvbptr)
    goto out_err;
    - }
    res->flags = DLM_LKF_VALBLK;
    }

    @@ -852,10 +848,8 @@ static int join(struct mddev *mddev, int nodes)
    /* Initiate the communication resources */
    ret = -ENOMEM;
    cinfo->recv_thread = md_register_thread(recv_daemon, mddev, "cluster_recv");
    - if (!cinfo->recv_thread) {
    - pr_err("md-cluster: cannot allocate memory for recv_thread!\n");
    + if (!cinfo->recv_thread)
    goto err;
    - }
    cinfo->message_lockres = lockres_init(mddev, "message", NULL, 1);
    if (!cinfo->message_lockres)
    goto err;
    @@ -1191,10 +1185,8 @@ static int lock_all_bitmaps(struct mddev *mddev)
    sizeof(*cinfo
    ->other_bitmap_lockres),
    GFP_KERNEL);
    - if (!cinfo->other_bitmap_lockres) {
    - pr_err("md: can't alloc mem for other bitmap locks\n");
    + if (!cinfo->other_bitmap_lockres)
    return 0;
    - }

    my_slot = slot_number(mddev);
    for (slot = 0; slot < mddev->bitmap_info.nodes; slot++) {
    --
    2.10.0
    \
     
     \ /
      Last update: 2016-10-01 16:57    [W:4.032 / U:0.368 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site