diff mbox

drm/amd/display: checking for NULL instead of IS_ERR()

Message ID 20171106114340.w6li3f4iltg24bdp@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Nov. 6, 2017, 11:43 a.m. UTC
backlight_device_register() never returns NULL, it returns error
pointers on error so the check here is wrong.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Christian König Nov. 6, 2017, 11:51 a.m. UTC | #1
Am 06.11.2017 um 12:43 schrieb Dan Carpenter:
> backlight_device_register() never returns NULL, it returns error
> pointers on error so the check here is wrong.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Christian König <christian.koenig@amd.com>

>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 33a15a1d818c..75f9383f5b9b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1296,7 +1296,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
>   			&amdgpu_dm_backlight_ops,
>   			&props);
>   
> -	if (NULL == dm->backlight_dev)
> +	if (IS_ERR(dm->backlight_dev))
>   		DRM_ERROR("DM: Backlight registration failed!\n");
>   	else
>   		DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);
Alex Deucher Nov. 6, 2017, 9:30 p.m. UTC | #2
On Mon, Nov 6, 2017 at 6:51 AM, Christian König
<christian.koenig@amd.com> wrote:
> Am 06.11.2017 um 12:43 schrieb Dan Carpenter:
>>
>> backlight_device_register() never returns NULL, it returns error
>> pointers on error so the check here is wrong.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Acked-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex

>
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 33a15a1d818c..75f9383f5b9b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -1296,7 +1296,7 @@ amdgpu_dm_register_backlight_device(struct
>> amdgpu_display_manager *dm)
>>                         &amdgpu_dm_backlight_ops,
>>                         &props);
>>   -     if (NULL == dm->backlight_dev)
>> +       if (IS_ERR(dm->backlight_dev))
>>                 DRM_ERROR("DM: Backlight registration failed!\n");
>>         else
>>                 DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n",
>> bl_name);
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 33a15a1d818c..75f9383f5b9b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1296,7 +1296,7 @@  amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
 			&amdgpu_dm_backlight_ops,
 			&props);
 
-	if (NULL == dm->backlight_dev)
+	if (IS_ERR(dm->backlight_dev))
 		DRM_ERROR("DM: Backlight registration failed!\n");
 	else
 		DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);