diff mbox series

[-next,1/7] drm/amdkfd: Remove unnecessary NULL values

Message ID 20230809034445.434902-2-ruanjinjie@huawei.com (mailing list archive)
State Not Applicable, archived
Headers show
Series drm: Remove many unnecessary NULL values | expand

Commit Message

Jinjie Ruan Aug. 9, 2023, 3:44 a.m. UTC
The NULL initialization of the pointers assigned by kzalloc() first is
not necessary, because if the kzalloc() failed, the pointers will be
assigned NULL, otherwise it works as usual. so remove it.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christian König Aug. 9, 2023, 6:15 a.m. UTC | #1
Am 09.08.23 um 05:44 schrieb Ruan Jinjie:
> The NULL initialization of the pointers assigned by kzalloc() first is
> not necessary, because if the kzalloc() failed, the pointers will be
> assigned NULL, otherwise it works as usual. so remove it.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for this one, 
the amd display code and the radeon stuff.

Thanks,
Christian.

> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> index 863cf060af48..d01bb57733b3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> @@ -48,7 +48,7 @@ int pipe_priority_map[] = {
>   
>   struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properties *q)
>   {
> -	struct kfd_mem_obj *mqd_mem_obj = NULL;
> +	struct kfd_mem_obj *mqd_mem_obj;
>   
>   	mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
>   	if (!mqd_mem_obj)
> @@ -64,7 +64,7 @@ struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properti
>   struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_node *dev,
>   					struct queue_properties *q)
>   {
> -	struct kfd_mem_obj *mqd_mem_obj = NULL;
> +	struct kfd_mem_obj *mqd_mem_obj;
>   	uint64_t offset;
>   
>   	mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
Alex Deucher Aug. 9, 2023, 1:11 p.m. UTC | #2
Applied.  Thanks!

On Wed, Aug 9, 2023 at 2:15 AM Christian König <christian.koenig@amd.com> wrote:
>
> Am 09.08.23 um 05:44 schrieb Ruan Jinjie:
> > The NULL initialization of the pointers assigned by kzalloc() first is
> > not necessary, because if the kzalloc() failed, the pointers will be
> > assigned NULL, otherwise it works as usual. so remove it.
> >
> > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com> for this one,
> the amd display code and the radeon stuff.
>
> Thanks,
> Christian.
>
> > ---
> >   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> > index 863cf060af48..d01bb57733b3 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> > @@ -48,7 +48,7 @@ int pipe_priority_map[] = {
> >
> >   struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properties *q)
> >   {
> > -     struct kfd_mem_obj *mqd_mem_obj = NULL;
> > +     struct kfd_mem_obj *mqd_mem_obj;
> >
> >       mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
> >       if (!mqd_mem_obj)
> > @@ -64,7 +64,7 @@ struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properti
> >   struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_node *dev,
> >                                       struct queue_properties *q)
> >   {
> > -     struct kfd_mem_obj *mqd_mem_obj = NULL;
> > +     struct kfd_mem_obj *mqd_mem_obj;
> >       uint64_t offset;
> >
> >       mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
index 863cf060af48..d01bb57733b3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
@@ -48,7 +48,7 @@  int pipe_priority_map[] = {
 
 struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properties *q)
 {
-	struct kfd_mem_obj *mqd_mem_obj = NULL;
+	struct kfd_mem_obj *mqd_mem_obj;
 
 	mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
 	if (!mqd_mem_obj)
@@ -64,7 +64,7 @@  struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_node *dev, struct queue_properti
 struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_node *dev,
 					struct queue_properties *q)
 {
-	struct kfd_mem_obj *mqd_mem_obj = NULL;
+	struct kfd_mem_obj *mqd_mem_obj;
 	uint64_t offset;
 
 	mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);