From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760926Ab3JPQhT (ORCPT ); Wed, 16 Oct 2013 12:37:19 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44462 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760807Ab3JPQhS (ORCPT ); Wed, 16 Oct 2013 12:37:18 -0400 Date: Wed, 16 Oct 2013 18:40:16 +0200 Message-ID: From: Takashi Iwai To: "Geyslan G. Bem" Cc: kernel-br@googlegroups.com, Jaroslav Kysela , Bill Pemberton , alsa-devel@alsa-project.org (moderated list:SOUND), linux-kernel@vger.kernel.org (open list) Subject: Re: [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c In-Reply-To: <1381940506-29855-1-git-send-email-geyslan@gmail.com> References: <1381940506-29855-1-git-send-email-geyslan@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Wed, 16 Oct 2013 13:21:45 -0300, Geyslan G. Bem wrote: > > Casting (void *) value returned by kcalloc is useless > as mentioned in Documentation/CodingStyle, Chap 14. > > Signed-off-by: Geyslan G. Bem You missed __user prefix. You can't cast user and kernel pointers implicitly. Takashi > --- > sound/pci/emu10k1/emufx.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c > index 0275209..3f51dac 100644 > --- a/sound/pci/emu10k1/emufx.c > +++ b/sound/pci/emu10k1/emufx.c > @@ -1183,9 +1183,8 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) > mm_segment_t seg; > > if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL || > - (icode->gpr_map = (u_int32_t __user *) > - kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), > - GFP_KERNEL)) == NULL || > + (icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), > + GFP_KERNEL)) == NULL || > (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, > sizeof(*controls), GFP_KERNEL)) == NULL) { > err = -ENOMEM; > @@ -1815,10 +1814,9 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu) > > if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL) > return -ENOMEM; > - if ((icode->gpr_map = (u_int32_t __user *) > - kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), > - GFP_KERNEL)) == NULL || > - (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, > + if ((icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), > + GFP_KERNEL)) == NULL || > + (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, > sizeof(struct snd_emu10k1_fx8010_control_gpr), > GFP_KERNEL)) == NULL || > (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) { > -- > 1.8.4 >