linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: emu10k1: Remove cast from memory allocation
@ 2017-02-22  6:47 Tobin C. Harding
  2017-02-22  6:59 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Tobin C. Harding @ 2017-02-22  6:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: kernel-janitors, linux-kernel, Tobin C. Harding

Coccinelle emits multiple WARNING: casting value returned by memory allocation
function to (u_int32_t __user *) is useless.

Remove unnecessary cast.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 sound/pci/emu10k1/emufx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 56fc47b..8a39a6f 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1186,8 +1186,8 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
 	if (!icode)
 		return err;
 
-	icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024,
-						      sizeof(u_int32_t), GFP_KERNEL);
+	icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024,
+				sizeof(u_int32_t), GFP_KERNEL);
 	if (!icode->gpr_map)
 		goto __err_gpr;
 	controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
@@ -1824,8 +1824,8 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
 	if (!icode)
 		return err;
 
-	icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512,
-						      sizeof(u_int32_t), GFP_KERNEL);
+	icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512,
+				sizeof(u_int32_t), GFP_KERNEL);
 	if (!icode->gpr_map)
 		goto __err_gpr;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: emu10k1: Remove cast from memory allocation
  2017-02-22  6:47 [PATCH] ALSA: emu10k1: Remove cast from memory allocation Tobin C. Harding
@ 2017-02-22  6:59 ` Takashi Iwai
  2017-02-22 10:37   ` Tobin C. Harding
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2017-02-22  6:59 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: Jaroslav Kysela, tiwai, kernel-janitors, linux-kernel

On Wed, 22 Feb 2017 07:47:16 +0100,
Tobin C. Harding wrote:
> 
> Coccinelle emits multiple WARNING: casting value returned by memory allocation
> function to (u_int32_t __user *) is useless.
> 
> Remove unnecessary cast.
> 
> Signed-off-by: Tobin C. Harding <me@tobin.cc>

__user annotation requires the explicit cast.


Takashi


> ---
>  sound/pci/emu10k1/emufx.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
> index 56fc47b..8a39a6f 100644
> --- a/sound/pci/emu10k1/emufx.c
> +++ b/sound/pci/emu10k1/emufx.c
> @@ -1186,8 +1186,8 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
>  	if (!icode)
>  		return err;
>  
> -	icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024,
> -						      sizeof(u_int32_t), GFP_KERNEL);
> +	icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024,
> +				sizeof(u_int32_t), GFP_KERNEL);
>  	if (!icode->gpr_map)
>  		goto __err_gpr;
>  	controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
> @@ -1824,8 +1824,8 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
>  	if (!icode)
>  		return err;
>  
> -	icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512,
> -						      sizeof(u_int32_t), GFP_KERNEL);
> +	icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512,
> +				sizeof(u_int32_t), GFP_KERNEL);
>  	if (!icode->gpr_map)
>  		goto __err_gpr;
>  
> -- 
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: emu10k1: Remove cast from memory allocation
  2017-02-22  6:59 ` Takashi Iwai
@ 2017-02-22 10:37   ` Tobin C. Harding
  0 siblings, 0 replies; 3+ messages in thread
From: Tobin C. Harding @ 2017-02-22 10:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Jaroslav Kysela, kernel-janitors, linux-kernel

On Wed, Feb 22, 2017 at 07:59:57AM +0100, Takashi Iwai wrote:
> On Wed, 22 Feb 2017 07:47:16 +0100,
> Tobin C. Harding wrote:
> > 
> > Coccinelle emits multiple WARNING: casting value returned by memory allocation
> > function to (u_int32_t __user *) is useless.
> > 
> > Remove unnecessary cast.
> > 
> > Signed-off-by: Tobin C. Harding <me@tobin.cc>
> 
> __user annotation requires the explicit cast.

Ok, thanks for reviewing.

Tobin.

> 
> 
> Takashi
> 
> 
> > ---
> >  sound/pci/emu10k1/emufx.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
> > index 56fc47b..8a39a6f 100644
> > --- a/sound/pci/emu10k1/emufx.c
> > +++ b/sound/pci/emu10k1/emufx.c
> > @@ -1186,8 +1186,8 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
> >  	if (!icode)
> >  		return err;
> >  
> > -	icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024,
> > -						      sizeof(u_int32_t), GFP_KERNEL);
> > +	icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024,
> > +				sizeof(u_int32_t), GFP_KERNEL);
> >  	if (!icode->gpr_map)
> >  		goto __err_gpr;
> >  	controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
> > @@ -1824,8 +1824,8 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
> >  	if (!icode)
> >  		return err;
> >  
> > -	icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512,
> > -						      sizeof(u_int32_t), GFP_KERNEL);
> > +	icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512,
> > +				sizeof(u_int32_t), GFP_KERNEL);
> >  	if (!icode->gpr_map)
> >  		goto __err_gpr;
> >  
> > -- 
> > 2.7.4
> > 
> > 

-- 
Tobin Harding
http://tobin.cc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-22 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22  6:47 [PATCH] ALSA: emu10k1: Remove cast from memory allocation Tobin C. Harding
2017-02-22  6:59 ` Takashi Iwai
2017-02-22 10:37   ` Tobin C. Harding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).