From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Wed, 28 Sep 2016 22:33:09 +0200 Omit extra messages for a memory allocation failure in this function. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/md/dm-snap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index f262f7e..7d81390 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -329,10 +329,8 @@ static int init_origin_hash(void) _origins = kmalloc_array(ORIGIN_HASH_SIZE, sizeof(*_origins), GFP_KERNEL); - if (!_origins) { - DMERR("unable to allocate memory for _origins"); + if (!_origins) return -ENOMEM; - } for (i = 0; i < ORIGIN_HASH_SIZE; i++) INIT_LIST_HEAD(_origins + i); @@ -340,7 +338,6 @@ static int init_origin_hash(void) sizeof(*_dm_origins), GFP_KERNEL); if (!_dm_origins) { - DMERR("unable to allocate memory for _dm_origins"); kfree(_origins); return -ENOMEM; } -- 2.10.0 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html