From patchwork Thu Jan 19 09:09:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 716985 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3v3ymJ4TdWz9t1H for ; Thu, 19 Jan 2017 20:12:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbdASJMk (ORCPT ); Thu, 19 Jan 2017 04:12:40 -0500 Received: from mga04.intel.com ([192.55.52.120]:15298 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbdASJMi (ORCPT ); Thu, 19 Jan 2017 04:12:38 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 19 Jan 2017 01:09:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,253,1477983600"; d="scan'208";a="924282541" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga003.jf.intel.com with ESMTP; 19 Jan 2017 01:09:33 -0800 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1cU8ky-0004y1-Gi; Thu, 19 Jan 2017 17:11:44 +0800 Date: Thu, 19 Jan 2017 17:09:31 +0800 From: kbuild test robot To: Alexander Loktionov Cc: kbuild-all@01.org, netdev@vger.kernel.org, David VomLehn , "David S . Miller" , Simon Edelhaus , Alexander Loktionov , Dmitrii Tarakanov , Pavel Belous , Dmitry Bezrukov Subject: [PATCH] net: ethernet: aquantia: fix alloc_cast.cocci warnings Message-ID: <20170119090931.GA28354@lkp-ne04.lkp.intel.com> References: <201701191708.e8q1JvlR%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org drivers/net/ethernet/aquantia/atlantic/aq_ring.c:24:20-41: WARNING: casting value returned by memory allocation function to (struct aq_ring_buff_s *) is useless. Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc. Semantic patch information: This makes an effort to find cases of casting of values returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc, kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes the casting as it is not required. The result in the patch case may need some reformatting. Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci CC: David VomLehn Signed-off-by: Fengguang Wu --- aq_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c @@ -21,7 +21,7 @@ static struct aq_ring_s *aq_ring_alloc(s { int err = 0; - self->buff_ring = (struct aq_ring_buff_s *) + self->buff_ring = kzalloc(sizeof(struct aq_ring_buff_s) * self->size, GFP_KERNEL); if (!self->buff_ring) {