All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher@amd.com>
To: "'Thomas Meyer'" <thomas@m3y3r.de>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"
Date: Thu, 21 Sep 2017 06:55:33 +0000	[thread overview]
Message-ID: <BN6PR12MB165298D846B4B0BB35C0FD72F7660@BN6PR12MB1652.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1505975570447-1553434828-1-diffsplit-thomas@m3y3r.de>

> -----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)

  reply	other threads:[~2017-09-21  6:55 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR12MB165298D846B4B0BB35C0FD72F7660@BN6PR12MB1652.namprd12.prod.outlook.com \
    --to=alexander.deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas@m3y3r.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.