* [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c
@ 2013-10-16 16:21 Geyslan G. Bem
2013-10-16 16:40 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Geyslan G. Bem @ 2013-10-16 16:21 UTC (permalink / raw)
Cc: kernel-br, Geyslan G. Bem, Jaroslav Kysela, Takashi Iwai,
Bill Pemberton, moderated list:SOUND, open list
Casting (void *) value returned by kcalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.
Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c
2013-10-16 16:21 [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c Geyslan G. Bem
@ 2013-10-16 16:40 ` Takashi Iwai
2013-10-16 16:42 ` Geyslan Gregório Bem
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2013-10-16 16:40 UTC (permalink / raw)
To: Geyslan G. Bem
Cc: kernel-br, Jaroslav Kysela, Bill Pemberton, moderated list:SOUND,
open list
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 <geyslan@gmail.com>
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c
2013-10-16 16:40 ` Takashi Iwai
@ 2013-10-16 16:42 ` Geyslan Gregório Bem
2013-10-16 22:15 ` Geyslan Gregório Bem
0 siblings, 1 reply; 4+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-16 16:42 UTC (permalink / raw)
To: Takashi Iwai
Cc: kernel-br, Jaroslav Kysela, Bill Pemberton, moderated list:SOUND,
open list
2013/10/16 Takashi Iwai <tiwai@suse.de>:
> 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 <geyslan@gmail.com>
>
> You missed __user prefix. You can't cast user and kernel pointers
> implicitly.
>
>
> Takashi
>
Takashi,
My mistake, I'll fix that later.
Thank you.
>> ---
>> 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
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c
2013-10-16 16:42 ` Geyslan Gregório Bem
@ 2013-10-16 22:15 ` Geyslan Gregório Bem
0 siblings, 0 replies; 4+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-16 22:15 UTC (permalink / raw)
To: Takashi Iwai
Cc: kernel-br, Jaroslav Kysela, Bill Pemberton, moderated list:SOUND,
open list
2013/10/16 Geyslan Gregório Bem <geyslan@gmail.com>:
> 2013/10/16 Takashi Iwai <tiwai@suse.de>:
>> 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 <geyslan@gmail.com>
>>
>> You missed __user prefix. You can't cast user and kernel pointers
>> implicitly.
>>
>>
>> Takashi
>>
>
> Takashi,
>
> My mistake, I'll fix that later.
>
> Thank you.
I sent a substitute patch:
[PATCH] sound: pci: emu10k1: code refactoring and casting removal
Thank you.
>
>>> ---
>>> 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
>>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-16 22:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 16:21 [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c Geyslan G. Bem
2013-10-16 16:40 ` Takashi Iwai
2013-10-16 16:42 ` Geyslan Gregório Bem
2013-10-16 22:15 ` Geyslan Gregório Bem
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®