Message ID | 20230801125514.378451-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next] drm/amd/pm: Remove many unnecessary NULL values | expand |
[AMD Official Use Only - General] Reviewed-by: Evan Quan <evan.quan@amd.com> > -----Original Message----- > From: Ruan Jinjie <ruanjinjie@huawei.com> > Sent: Tuesday, August 1, 2023 8:55 PM > To: Quan, Evan <Evan.Quan@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Koenig, Christian > <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; > airlied@gmail.com; daniel@ffwll.ch; mripard@kernel.org; > tzimmermann@suse.de; drv@mailo.com; amd-gfx@lists.freedesktop.org; dri- > devel@lists.freedesktop.org > Cc: ruanjinjie@huawei.com > Subject: [PATCH -next] drm/amd/pm: Remove many unnecessary NULL values > > Ther are many pointers assigned first, which need not to be initialized, so > remove the NULL assignment. > > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> > --- > drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 +- > drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 2 +- > drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 2 +- > drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c | 2 +- > drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c | 2 +- > 5 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c > b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c > index 182118e3fd5f..5794b64507bf 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c > @@ -1237,7 +1237,7 @@ static int get_vce_clock_voltage_limit_table(struct > pp_hwmgr *hwmgr, > const VCEClockInfoArray *array) > { > unsigned long i; > - struct phm_vce_clock_voltage_dependency_table *vce_table = NULL; > + struct phm_vce_clock_voltage_dependency_table *vce_table; > > vce_table = kzalloc(struct_size(vce_table, entries, table->numEntries), > GFP_KERNEL); > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c > index 4bc8db1be738..9e4228232f02 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c > @@ -2732,7 +2732,7 @@ static bool ci_is_dpm_running(struct pp_hwmgr > *hwmgr) > > static int ci_smu_init(struct pp_hwmgr *hwmgr) > { > - struct ci_smumgr *ci_priv = NULL; > + struct ci_smumgr *ci_priv; > > ci_priv = kzalloc(sizeof(struct ci_smumgr), GFP_KERNEL); > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > index 02c094a06605..5e43ad2b2956 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > @@ -332,7 +332,7 @@ static bool fiji_is_hw_avfs_present(struct pp_hwmgr > *hwmgr) > > static int fiji_smu_init(struct pp_hwmgr *hwmgr) > { > - struct fiji_smumgr *fiji_priv = NULL; > + struct fiji_smumgr *fiji_priv; > > fiji_priv = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL); > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c > index 060fc140c574..97d9802fe673 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c > @@ -259,7 +259,7 @@ static int iceland_start_smu(struct pp_hwmgr > *hwmgr) > > static int iceland_smu_init(struct pp_hwmgr *hwmgr) > { > - struct iceland_smumgr *iceland_priv = NULL; > + struct iceland_smumgr *iceland_priv; > > iceland_priv = kzalloc(sizeof(struct iceland_smumgr), GFP_KERNEL); > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c > index acbe41174d7e..6fe6e6abb5d8 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c > @@ -226,7 +226,7 @@ static int tonga_start_smu(struct pp_hwmgr > *hwmgr) > > static int tonga_smu_init(struct pp_hwmgr *hwmgr) > { > - struct tonga_smumgr *tonga_priv = NULL; > + struct tonga_smumgr *tonga_priv; > > tonga_priv = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL); > if (tonga_priv == NULL) > -- > 2.34.1
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c index 182118e3fd5f..5794b64507bf 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c @@ -1237,7 +1237,7 @@ static int get_vce_clock_voltage_limit_table(struct pp_hwmgr *hwmgr, const VCEClockInfoArray *array) { unsigned long i; - struct phm_vce_clock_voltage_dependency_table *vce_table = NULL; + struct phm_vce_clock_voltage_dependency_table *vce_table; vce_table = kzalloc(struct_size(vce_table, entries, table->numEntries), GFP_KERNEL); diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c index 4bc8db1be738..9e4228232f02 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c @@ -2732,7 +2732,7 @@ static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr) static int ci_smu_init(struct pp_hwmgr *hwmgr) { - struct ci_smumgr *ci_priv = NULL; + struct ci_smumgr *ci_priv; ci_priv = kzalloc(sizeof(struct ci_smumgr), GFP_KERNEL); diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c index 02c094a06605..5e43ad2b2956 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c @@ -332,7 +332,7 @@ static bool fiji_is_hw_avfs_present(struct pp_hwmgr *hwmgr) static int fiji_smu_init(struct pp_hwmgr *hwmgr) { - struct fiji_smumgr *fiji_priv = NULL; + struct fiji_smumgr *fiji_priv; fiji_priv = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL); diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c index 060fc140c574..97d9802fe673 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c @@ -259,7 +259,7 @@ static int iceland_start_smu(struct pp_hwmgr *hwmgr) static int iceland_smu_init(struct pp_hwmgr *hwmgr) { - struct iceland_smumgr *iceland_priv = NULL; + struct iceland_smumgr *iceland_priv; iceland_priv = kzalloc(sizeof(struct iceland_smumgr), GFP_KERNEL); diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c index acbe41174d7e..6fe6e6abb5d8 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c @@ -226,7 +226,7 @@ static int tonga_start_smu(struct pp_hwmgr *hwmgr) static int tonga_smu_init(struct pp_hwmgr *hwmgr) { - struct tonga_smumgr *tonga_priv = NULL; + struct tonga_smumgr *tonga_priv; tonga_priv = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL); if (tonga_priv == NULL)
Ther are many pointers assigned first, which need not to be initialized, so remove the NULL assignment. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)