From patchwork Fri Oct 6 20:56:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 9990351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6464760247 for ; Fri, 6 Oct 2017 20:56:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5668828DD8 for ; Fri, 6 Oct 2017 20:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B53228DE4; Fri, 6 Oct 2017 20:56:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C61628DD8 for ; Fri, 6 Oct 2017 20:56:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D16366E9B5; Fri, 6 Oct 2017 20:56:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 451BE6E99E for ; Fri, 6 Oct 2017 20:56:36 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 06 Oct 2017 13:56:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,484,1500966000"; d="scan'208"; a="1203129545" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by fmsmga001.fm.intel.com with ESMTP; 06 Oct 2017 13:56:35 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1e0Zki-000Kyd-Nq; Sat, 07 Oct 2017 05:01:48 +0800 Date: Sat, 7 Oct 2017 04:56:13 +0800 From: kbuild test robot To: Harry Wentland Subject: [PATCH] drm/amd/display: fix alloc_cast.cocci warnings Message-ID: <20171006205613.GA54186@lkp-sbx04> References: <201710070408.YLgv92HD%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201710070408.YLgv92HD%fengguang.wu@intel.com> 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 Cc: Alex Deucher , kbuild-all@01.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c:73:23-27: WARNING: casting value returned by memory allocation function to (char *) 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 Fixes: 2004f45ef83f ("drm/amd/display: Use kernel alloc/free") CC: Harry Wentland Signed-off-by: Fengguang Wu --- logger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c +++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/basics/logger.c @@ -70,7 +70,7 @@ static bool construct(struct dc_context { /* malloc buffer and init offsets */ logger->log_buffer_size = DAL_LOGGER_BUFFER_MAX_SIZE; - logger->log_buffer = (char *)kzalloc(logger->log_buffer_size * sizeof(char), + logger->log_buffer = kzalloc(logger->log_buffer_size * sizeof(char), GFP_KERNEL); if (!logger->log_buffer)