Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbdH0XQJ convert rfc822-to-8bit (ORCPT ); Sun, 27 Aug 2017 19:16:09 -0400 Received: from mga04.intel.com ([192.55.52.120]:57225 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdH0XQH (ORCPT ); Sun, 27 Aug 2017 19:16:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,438,1498546800"; d="scan'208";a="1008168837" From: "Waskiewicz Jr, Peter" To: SF Markus Elfring , "netdev@vger.kernel.org" , Evgeniy Polyakov CC: LKML , "kernel-janitors@vger.kernel.org" Subject: Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Thread-Topic: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Thread-Index: AQHTH2pkcImrtsVZ90y9AMr+YsBhnw== Date: Sun, 27 Aug 2017 23:16:06 +0000 Message-ID: References: <7b206228-b3e9-5cb9-873c-75b5d8aae23b@users.sourceforge.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.82.203] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 41 On 8/27/17 3:26 PM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 27 Aug 2017 21:18:37 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. Did coccinelle trip on the message or the fact you weren't returning NULL? > > Signed-off-by: Markus Elfring > --- > drivers/connector/cn_queue.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c > index 1f8bf054d11c..e4f31d679f02 100644 > --- a/drivers/connector/cn_queue.c > +++ b/drivers/connector/cn_queue.c > @@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, > struct cn_callback_entry *cbq; > > cbq = kzalloc(sizeof(*cbq), GFP_KERNEL); > - if (!cbq) { > - pr_err("Failed to create new callback queue.\n"); > + if (!cbq) > return NULL; > - } Wny not: if (!cbq) { pr_err("Failed to create new callback queue.\n"); + return NULL; } > > atomic_set(&cbq->refcnt, 1); > >