mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/4] ALSA: emu10k1: Cocci spatch "alloc_cast"
  2017-09-21  6:33 [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1 Thomas Meyer
                   ` (2 preceding siblings ...)
  2017-09-21  6:33 ` [PATCH 3/4] VFS: normal filesystems (and lustre): " Thomas Meyer
@ 2017-09-21  6:33 ` Thomas Meyer
  2017-09-21  8:00   ` Takashi Iwai
  2017-09-21 17:39   ` Al Viro
  3 siblings, 2 replies; 10+ messages in thread
From: Thomas Meyer @ 2017-09-21  6:33 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel, linux-kernel

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 <thomas@m3y3r.de>
---

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;

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

* [PATCH 2/4] fs: Cocci spatch "alloc_cast"
  2017-09-21  6:33 [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1 Thomas Meyer
@ 2017-09-21  6:33 ` Thomas Meyer
  2017-09-21  6:33 ` [PATCH 1/4] drm/amd/powerplay: " Thomas Meyer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Thomas Meyer @ 2017-09-21  6:33 UTC (permalink / raw)
  To: ericvh, rminnich, lucho, v9fs-developer, linux-kernel

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 <thomas@m3y3r.de>
---

diff -u -p a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -238,7 +238,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
 struct inode *v9fs_alloc_inode(struct super_block *sb)
 {
 	struct v9fs_inode *v9inode;
-	v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache,
+	v9inode = kmem_cache_alloc(v9fs_inode_cache,
 							GFP_KERNEL);
 	if (!v9inode)
 		return NULL;

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

* [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1
@ 2017-09-21  6:33 Thomas Meyer
  2017-09-21  6:33 ` [PATCH 2/4] fs: Cocci spatch "alloc_cast" Thomas Meyer
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Thomas Meyer @ 2017-09-21  6:33 UTC (permalink / raw)
  To: linux-kernel

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"

Run against version v4.14-rc1

Let me know when you as a maintainer are not interested in these kind of patches.
I can exclude you by path; e.g. all findings in "drivers/scsi" will never
be reported again by this semi-automatic program runs.

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

* [PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch "alloc_cast"
  2017-09-21  6:33 [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1 Thomas Meyer
  2017-09-21  6:33 ` [PATCH 2/4] fs: Cocci spatch "alloc_cast" Thomas Meyer
  2017-09-21  6:33 ` [PATCH 1/4] drm/amd/powerplay: " Thomas Meyer
@ 2017-09-21  6:33 ` Thomas Meyer
  2017-09-21  6:33 ` [PATCH 4/4] ALSA: emu10k1: " Thomas Meyer
  3 siblings, 0 replies; 10+ messages in thread
From: Thomas Meyer @ 2017-09-21  6:33 UTC (permalink / raw)
  To: linux-kernel

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 <thomas@m3y3r.de>
---

diff -u -p a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -53,7 +53,7 @@ static struct kmem_cache * ncp_inode_cac
 static struct inode *ncp_alloc_inode(struct super_block *sb)
 {
 	struct ncp_inode_info *ei;
-	ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
+	ei = kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
 	if (!ei)
 		return NULL;
 	return &ei->vfs_inode;

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

* [PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"
  2017-09-21  6:33 [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1 Thomas Meyer
  2017-09-21  6:33 ` [PATCH 2/4] fs: Cocci spatch "alloc_cast" Thomas Meyer
@ 2017-09-21  6:33 ` Thomas Meyer
  2017-09-21  6:55   ` Deucher, Alexander
  2017-09-26 16:10   ` Alex Deucher
  2017-09-21  6:33 ` [PATCH 3/4] VFS: normal filesystems (and lustre): " Thomas Meyer
  2017-09-21  6:33 ` [PATCH 4/4] ALSA: emu10k1: " Thomas Meyer
  3 siblings, 2 replies; 10+ messages in thread
From: Thomas Meyer @ 2017-09-21  6:33 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, amd-gfx, dri-devel,
	linux-kernel

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 <thomas@m3y3r.de>
---

diff -u -p a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -291,7 +291,7 @@ static int get_mm_clock_voltage_table(
 	table_size = sizeof(uint32_t) +
 			sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
 			mm_dependency_table->ucNumEntries;
-	mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
+	mm_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!mm_table)
@@ -519,7 +519,7 @@ static int get_socclk_voltage_dependency
 			sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
 			clk_dep_table->ucNumEntries;
 
-	clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
+	clk_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!clk_table)
@@ -554,7 +554,7 @@ static int get_mclk_voltage_dependency_t
 			sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
 			mclk_dep_table->ucNumEntries;
 
-	mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
+	mclk_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!mclk_table)
@@ -596,7 +596,7 @@ static int get_gfxclk_voltage_dependency
 			sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
 			clk_dep_table->ucNumEntries;
 
-	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+	clk_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!clk_table)
@@ -663,7 +663,7 @@ static int get_pix_clk_voltage_dependenc
 			sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
 			clk_dep_table->ucNumEntries;
 
-	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+	clk_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!clk_table)
@@ -728,7 +728,7 @@ static int get_dcefclk_voltage_dependenc
 			sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
 			num_entries;
 
-	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+	clk_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!clk_table)
@@ -772,7 +772,7 @@ static int get_pcie_table(struct pp_hwmg
 			sizeof(struct phm_ppt_v1_pcie_record) *
 			atom_pcie_table->ucNumEntries;
 
-	pcie_table = (struct phm_ppt_v1_pcie_table *)
+	pcie_table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (!pcie_table)
@@ -1026,7 +1026,7 @@ static int get_vddc_lookup_table(
 	table_size = sizeof(uint32_t) +
 			sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
 
-	table = (phm_ppt_v1_voltage_lookup_table *)
+	table =
 			kzalloc(table_size, GFP_KERNEL);
 
 	if (NULL == table)

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

* RE: [PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"
  2017-09-21  6:33 ` [PATCH 1/4] drm/amd/powerplay: " Thomas Meyer
@ 2017-09-21  6:55   ` Deucher, Alexander
  2017-09-26 16:10   ` Alex Deucher
  1 sibling, 0 replies; 10+ messages in thread
From: Deucher, Alexander @ 2017-09-21  6:55 UTC (permalink / raw)
  To: 'Thomas Meyer',
	Koenig, Christian, airlied, amd-gfx, dri-devel, linux-kernel

> -----Original Message-----
> From: Thomas Meyer [mailto:thomas@m3y3r.de]
> Sent: Thursday, September 21, 2017 2:34 AM
> To: Deucher, Alexander; Koenig, Christian; airlied@linux.ie; amd-
> gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"
> 
> 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 <thomas@m3y3r.de>
> ---
> 
> diff -u -p
> a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> @@ -291,7 +291,7 @@ static int get_mm_clock_voltage_table(
>  	table_size = sizeof(uint32_t) +
> 
> 	sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
>  			mm_dependency_table->ucNumEntries;
> -	mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table
> *)
> +	mm_table =
>  			kzalloc(table_size, GFP_KERNEL);

Please fix up the whitespace here and below.

Alex

> 
>  	if (!mm_table)
> @@ -519,7 +519,7 @@ static int get_socclk_voltage_dependency
> 
> 	sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>  			clk_dep_table->ucNumEntries;
> 
> -	clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
> +	clk_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!clk_table)
> @@ -554,7 +554,7 @@ static int get_mclk_voltage_dependency_t
> 
> 	sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>  			mclk_dep_table->ucNumEntries;
> 
> -	mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
> +	mclk_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!mclk_table)
> @@ -596,7 +596,7 @@ static int get_gfxclk_voltage_dependency
> 
> 	sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>  			clk_dep_table->ucNumEntries;
> 
> -	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +	clk_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!clk_table)
> @@ -663,7 +663,7 @@ static int get_pix_clk_voltage_dependenc
> 
> 	sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>  			clk_dep_table->ucNumEntries;
> 
> -	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +	clk_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!clk_table)
> @@ -728,7 +728,7 @@ static int get_dcefclk_voltage_dependenc
> 
> 	sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>  			num_entries;
> 
> -	clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +	clk_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!clk_table)
> @@ -772,7 +772,7 @@ static int get_pcie_table(struct pp_hwmg
>  			sizeof(struct phm_ppt_v1_pcie_record) *
>  			atom_pcie_table->ucNumEntries;
> 
> -	pcie_table = (struct phm_ppt_v1_pcie_table *)
> +	pcie_table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (!pcie_table)
> @@ -1026,7 +1026,7 @@ static int get_vddc_lookup_table(
>  	table_size = sizeof(uint32_t) +
>  			sizeof(phm_ppt_v1_voltage_lookup_record) *
> max_levels;
> 
> -	table = (phm_ppt_v1_voltage_lookup_table *)
> +	table =
>  			kzalloc(table_size, GFP_KERNEL);
> 
>  	if (NULL == table)

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

* Re: [PATCH 4/4] ALSA: emu10k1: Cocci spatch "alloc_cast"
  2017-09-21  6:33 ` [PATCH 4/4] ALSA: emu10k1: " Thomas Meyer
@ 2017-09-21  8:00   ` Takashi Iwai
  2017-09-21 17:39   ` Al Viro
  1 sibling, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2017-09-21  8:00 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: alsa-devel, perex, linux-kernel

On Thu, 21 Sep 2017 08:33:46 +0200,
Thomas Meyer wrote:
> 
> 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 <thomas@m3y3r.de>

No, this cast is still required because it has __user annotation.
It's not about compiler warning but about sparse.


thanks,

Takashi

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

* Re: [PATCH 4/4] ALSA: emu10k1: Cocci spatch "alloc_cast"
  2017-09-21  6:33 ` [PATCH 4/4] ALSA: emu10k1: " Thomas Meyer
  2017-09-21  8:00   ` Takashi Iwai
@ 2017-09-21 17:39   ` Al Viro
  2017-09-21 20:39     ` Takashi Iwai
  1 sibling, 1 reply; 10+ messages in thread
From: Al Viro @ 2017-09-21 17:39 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: perex, tiwai, alsa-devel, linux-kernel

On Thu, Sep 21, 2017 at 08:33:46AM +0200, Thomas Meyer wrote:
> 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 <thomas@m3y3r.de>
> ---
> 
> 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);

	And _this_ is a wonderful example of the reasons why that kind of
patches is bloody bad.  The code you've caught is very obviously smelly -
kcalloc() does *NOT* return a userland pointer.  You are whitewashing it;
a major "something weird is going on here" sign is gone (something weird
in that case is hopefully a set_fs(KERNEL_DS) somewhere nearby, and it
is asking for careful review).

	FWIW, any patches of that sort anywhere near VFS are very much not welcome.

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

* Re: [PATCH 4/4] ALSA: emu10k1: Cocci spatch "alloc_cast"
  2017-09-21 17:39   ` Al Viro
@ 2017-09-21 20:39     ` Takashi Iwai
  0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2017-09-21 20:39 UTC (permalink / raw)
  To: Al Viro; +Cc: Thomas Meyer, alsa-devel, perex, linux-kernel

On Thu, 21 Sep 2017 19:39:15 +0200,
Al Viro wrote:
> 
> On Thu, Sep 21, 2017 at 08:33:46AM +0200, Thomas Meyer wrote:
> > 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 <thomas@m3y3r.de>
> > ---
> > 
> > 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);
> 
> 	And _this_ is a wonderful example of the reasons why that kind of
> patches is bloody bad.  The code you've caught is very obviously smelly -
> kcalloc() does *NOT* return a userland pointer.  You are whitewashing it;
> a major "something weird is going on here" sign is gone (something weird
> in that case is hopefully a set_fs(KERNEL_DS) somewhere nearby, and it
> is asking for careful review).

Right, the code touched by the patch is a really tricky one.  It uses
the same struct that contains __user pointer which is supposed to be
filled by ioctl, but in this case, the function allocates the kernel
buffer and passes it with a special flag mentioning it being a kernel
buffer later.


thanks,

Takashi

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

* Re: [PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"
  2017-09-21  6:33 ` [PATCH 1/4] drm/amd/powerplay: " Thomas Meyer
  2017-09-21  6:55   ` Deucher, Alexander
@ 2017-09-26 16:10   ` Alex Deucher
  1 sibling, 0 replies; 10+ messages in thread
From: Alex Deucher @ 2017-09-26 16:10 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: Deucher, Alexander, Christian Koenig, Dave Airlie, amd-gfx list,
	Maling list - DRI developers, LKML

On Thu, Sep 21, 2017 at 2:33 AM, Thomas Meyer <thomas@m3y3r.de> wrote:
> 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 <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> @@ -291,7 +291,7 @@ static int get_mm_clock_voltage_table(
>         table_size = sizeof(uint32_t) +
>                         sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
>                         mm_dependency_table->ucNumEntries;
> -       mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
> +       mm_table =
>                         kzalloc(table_size, GFP_KERNEL);

Please fix up the whitespace.  E.g.,
 mm_table = kzalloc(table_size, GFP_KERNEL);

Alex


>
>         if (!mm_table)
> @@ -519,7 +519,7 @@ static int get_socclk_voltage_dependency
>                         sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>                         clk_dep_table->ucNumEntries;
>
> -       clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
> +       clk_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!clk_table)
> @@ -554,7 +554,7 @@ static int get_mclk_voltage_dependency_t
>                         sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>                         mclk_dep_table->ucNumEntries;
>
> -       mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
> +       mclk_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!mclk_table)
> @@ -596,7 +596,7 @@ static int get_gfxclk_voltage_dependency
>                         sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>                         clk_dep_table->ucNumEntries;
>
> -       clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +       clk_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!clk_table)
> @@ -663,7 +663,7 @@ static int get_pix_clk_voltage_dependenc
>                         sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>                         clk_dep_table->ucNumEntries;
>
> -       clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +       clk_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!clk_table)
> @@ -728,7 +728,7 @@ static int get_dcefclk_voltage_dependenc
>                         sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
>                         num_entries;
>
> -       clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
> +       clk_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!clk_table)
> @@ -772,7 +772,7 @@ static int get_pcie_table(struct pp_hwmg
>                         sizeof(struct phm_ppt_v1_pcie_record) *
>                         atom_pcie_table->ucNumEntries;
>
> -       pcie_table = (struct phm_ppt_v1_pcie_table *)
> +       pcie_table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (!pcie_table)
> @@ -1026,7 +1026,7 @@ static int get_vddc_lookup_table(
>         table_size = sizeof(uint32_t) +
>                         sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
>
> -       table = (phm_ppt_v1_voltage_lookup_table *)
> +       table =
>                         kzalloc(table_size, GFP_KERNEL);
>
>         if (NULL == table)
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-09-26 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21  6:33 [PATCH 0/4] Cocci spatch "alloc_cast" - v4.14-rc1 Thomas Meyer
2017-09-21  6:33 ` [PATCH 2/4] fs: Cocci spatch "alloc_cast" Thomas Meyer
2017-09-21  6:33 ` [PATCH 1/4] drm/amd/powerplay: " Thomas Meyer
2017-09-21  6:55   ` Deucher, Alexander
2017-09-26 16:10   ` Alex Deucher
2017-09-21  6:33 ` [PATCH 3/4] VFS: normal filesystems (and lustre): " Thomas Meyer
2017-09-21  6:33 ` [PATCH 4/4] ALSA: emu10k1: " Thomas Meyer
2017-09-21  8:00   ` Takashi Iwai
2017-09-21 17:39   ` Al Viro
2017-09-21 20:39     ` Takashi Iwai

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®