mbox series

[-next,0/7] drm: Remove many unnecessary NULL values

Message ID 20230809034445.434902-1-ruanjinjie@huawei.com
Headers show
Series drm: Remove many unnecessary NULL values | expand

Message

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

Ruan Jinjie (7):
  drm/amdkfd: Remove unnecessary NULL values
  drm/amd/display: Remove unnecessary NULL values
  drm/msm: Remove unnecessary NULL values
  drm/radeon: Remove unnecessary NULL values
  drm/virtio: Remove an unnecessary NULL value
  drm/format-helper: Remove unnecessary NULL values
  drm: Remove unnecessary NULL values

 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  |  4 +--
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |  4 +--
 .../drm/amd/display/dc/bios/bios_parser2.c    |  4 +--
 drivers/gpu/drm/drm_agpsupport.c              |  2 +-
 drivers/gpu/drm/drm_atomic_uapi.c             |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c       |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |  2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c      |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     |  2 +-
 drivers/gpu/drm/radeon/radeon_agp.c           |  2 +-
 drivers/gpu/drm/radeon/radeon_combios.c       |  6 ++--
 .../gpu/drm/radeon/radeon_legacy_encoders.c   |  4 +--
 .../gpu/drm/tests/drm_format_helper_test.c    | 28 +++++++++----------
 drivers/gpu/drm/virtio/virtgpu_submit.c       |  2 +-
 14 files changed, 33 insertions(+), 33 deletions(-)

Comments

Abhinav Kumar Aug. 12, 2023, 12:28 a.m. UTC | #1
On 8/8/2023 8:44 PM, Ruan Jinjie wrote:
> 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/msm/disp/dpu1/dpu_crtc.c | 2 +-
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Dmitry Osipenko Aug. 13, 2023, 1:14 a.m. UTC | #2
On 8/9/23 06:44, Ruan Jinjie wrote:
> The NULL initialization of the pointer assigned by kzalloc() first is
> not necessary, because if the kzalloc() failed, the pointer will be
> assigned NULL, otherwise it works as usual. so remove it.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/gpu/drm/virtio/virtgpu_submit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c
> index 3c00135ead45..82563dbec2ab 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_submit.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_submit.c
> @@ -274,7 +274,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev,
>  					 struct virtio_gpu_fence *fence,
>  					 u32 ring_idx)
>  {
> -	struct virtio_gpu_fence_event *e = NULL;
> +	struct virtio_gpu_fence_event *e;
>  	int ret;
>  
>  	e = kzalloc(sizeof(*e), GFP_KERNEL);

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Dmitry Baryshkov Oct. 8, 2023, 2:01 p.m. UTC | #3
On Wed, 09 Aug 2023 11:44:38 +0800, Ruan Jinjie wrote:
> The NULL initialization of the pointers assigned by kzalloc() or
> kunit_kzalloc() first is not necessary, because if the kzalloc() or
> kunit_kzalloc() failed, the pointers will be assigned NULL, otherwise
> it works as usual. so remove it.
> 
> Ruan Jinjie (7):
>   drm/amdkfd: Remove unnecessary NULL values
>   drm/amd/display: Remove unnecessary NULL values
>   drm/msm: Remove unnecessary NULL values
>   drm/radeon: Remove unnecessary NULL values
>   drm/virtio: Remove an unnecessary NULL value
>   drm/format-helper: Remove unnecessary NULL values
>   drm: Remove unnecessary NULL values
> 
> [...]

Applied, thanks!

[3/7] drm/msm: Remove unnecessary NULL values
      https://gitlab.freedesktop.org/lumag/msm/-/commit/92a48b6ed510

Best regards,