Re: [PATCH] drm/amd/display: fix ifnullfree.cocci warnings
On 2017-10-12 07:17 PM, kbuild test robot wrote: > drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: > WARNING: NULL check before freeing functions like kfree, debugfs_remove, > debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider > reorganizing relevant code to avoid passing NULL values. > drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:175:4-9: > WARNING: NULL check before freeing functions like kfree, debugfs_remove, > debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider > reorganizing relevant code to avoid passing NULL values. > > NULL check before some freeing functions is not needed. > > Based on checkpatch warning > "kfree(NULL) is safe this check is probably not required" > and kfreeaddr.cocci by Julia Lawall. > > Generated by: scripts/coccinelle/free/ifnullfree.cocci > > Fixes: f09cd1f46388 ("drm/amd/display: Use kernel alloc/free") > Signed-off-by: Fengguang WuReviewed-by: Harry Wentland Harry > --- > > gpio_service.c |6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > --- a/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c > +++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c > @@ -130,8 +130,7 @@ failure_2: > > slot = service->busyness[index_of_id]; > > - if (slot) > - kfree(slot); > + kfree(slot); > }; > > failure_1: > @@ -171,8 +170,7 @@ void dal_gpio_service_destroy( > do { > uint32_t *slot = (*ptr)->busyness[index_of_id]; > > - if (slot) > - kfree(slot); > + kfree(slot); > > ++index_of_id; > } while (index_of_id < GPIO_ID_COUNT); > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/amd/display: fix ifnullfree.cocci warnings
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:175:4-9: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: f09cd1f46388 ("drm/amd/display: Use kernel alloc/free") Signed-off-by: Fengguang Wu--- gpio_service.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c +++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c @@ -130,8 +130,7 @@ failure_2: slot = service->busyness[index_of_id]; - if (slot) - kfree(slot); + kfree(slot); }; failure_1: @@ -171,8 +170,7 @@ void dal_gpio_service_destroy( do { uint32_t *slot = (*ptr)->busyness[index_of_id]; - if (slot) - kfree(slot); + kfree(slot); ++index_of_id; } while (index_of_id < GPIO_ID_COUNT); ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/amd/display: fix ifnullfree.cocci warnings
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c:1802:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c:1804:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: 22cdbf5cc45d ("drm/amd/display: Universal cursor plane hook-up.") CC: Andrey GrodzovskySigned-off-by: Fengguang Wu --- amdgpu_dm_types.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c @@ -1798,10 +1798,8 @@ int amdgpu_dm_crtc_init(struct amdgpu_di return 0; fail: - if (acrtc) - kfree(acrtc); - if (cursor_plane) - kfree(cursor_plane); + kfree(acrtc); + kfree(cursor_plane); acrtc->crtc_id = -1; return res; } ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel