Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdIUGm7 (ORCPT ); Thu, 21 Sep 2017 02:42:59 -0400 Received: from www17.your-server.de ([213.133.104.17]:34800 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbdIUGm6 (ORCPT ); Thu, 21 Sep 2017 02:42:58 -0400 Subject: [PATCH 4/4] ALSA: emu10k1: Cocci spatch "alloc_cast" From: Thomas Meyer To: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Message-ID: <1505975570447-568224618-4-diffsplit-thomas@m3y3r.de> References: <1505975570447-826702259-0-diffsplit-thomas@m3y3r.de> In-Reply-To: <1505975570447-826702259-0-diffsplit-thomas@m3y3r.de> Date: Thu, 21 Sep 2017 08:33:46 +0200 X-Mailer: Evolution 3.22.6-1 Content-Transfer-Encoding: 7bit X-Authenticated-Sender: thomas@m3y3r.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 991 Lines: 28 Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc." Found by coccinelle spatch "api/alloc/alloc_cast.cocci" Signed-off-by: Thomas Meyer --- diff -u -p a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -1218,7 +1218,7 @@ static int _snd_emu10k1_audigy_init_efx( if (!icode) return err; - icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024, + icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL); if (!icode->gpr_map) goto __err_gpr; @@ -1853,7 +1853,7 @@ static int _snd_emu10k1_init_efx(struct if (!icode) return err; - icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512, + icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL); if (!icode->gpr_map) goto __err_gpr;