From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757950AbdEKQa1 (ORCPT ); Thu, 11 May 2017 12:30:27 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:33451 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757897AbdEKQaY (ORCPT ); Thu, 11 May 2017 12:30:24 -0400 Date: Thu, 11 May 2017 09:30:15 -0700 From: Stephen Hemminger To: SF Markus Elfring Cc: devel@linuxdriverproject.org, Haiyang Zhang , "K. Y. Srinivasan" , Stephen Hemminger , kernel-janitors@vger.kernel.org, LKML , Wolfram Sang Subject: Re: [PATCH 2/4] vmbus: Delete an error message for a failed memory allocation in vmbus_device_create() Message-ID: <20170511093015.4cdfdb6c@xeon-e3> In-Reply-To: <587dbcf5-8b12-fac7-693e-5f471e6d5167@users.sourceforge.net> References: <587dbcf5-8b12-fac7-693e-5f471e6d5167@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 May 2017 18:17:01 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 11 May 2017 17:33:14 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf > Signed-off-by: Markus Elfring > --- > drivers/hv/vmbus_drv.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index 6802d74f162c..96328aebae5a 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -1149,7 +1149,5 @@ struct hv_device *vmbus_device_create(const uuid_le *type, > - if (!child_device_obj) { > - pr_err("Unable to allocate device object for child device\n"); > + if (!child_device_obj) > return NULL; > - } > > child_device_obj->channel = channel; > memcpy(&child_device_obj->dev_type, type, sizeof(uuid_le)); Taking out the message assumes that all callers of this function either log an error or pass appropriate error code back to userspace. Did you walk back through all the callers? Just because an automated tool says that this needs to change does not mean it has to.