[PATCH 1/1] drm/amd/display: WARN_ON cleanups

Das, Nirmoy nirmoy.das at amd.com
Fri May 28 16:26:15 UTC 2021


On 5/28/2021 5:28 PM, Christian König wrote:
>
>
> Am 27.05.21 um 14:14 schrieb Nirmoy Das:
>> Uuse WARN_ON() inside if-condition when possible.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
>>   1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> 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 f2ed51484980..736eb537a8e4 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -315,8 +315,7 @@ get_crtc_by_otg_inst(struct amdgpu_device *adev,
>>       struct drm_crtc *crtc;
>>       struct amdgpu_crtc *amdgpu_crtc;
>>   -    if (otg_inst == -1) {
>> -        WARN_ON(1);
>> +    if (WARN_ON(otg_inst == -1)) {
>>           return adev->mode_info.crtcs[0];
>>       }
>
> While at it you could also drop the extra {} here.


I merged it this morning :/ I will speak with Alex to clean this up.


Nirmoy


>
> Apart from that patch is Acked-by: Christian König 
> <christian.koenig at amd.com>.
>
> Christian.
>
>>   @@ -397,8 +396,7 @@ static void dm_pflip_high_irq(void 
>> *interrupt_params)
>>       e = amdgpu_crtc->event;
>>       amdgpu_crtc->event = NULL;
>>   -    if (!e)
>> -        WARN_ON(1);
>> +    WARN_ON(!e);
>>         vrr_active = amdgpu_dm_vrr_active_irq(amdgpu_crtc);
>>   @@ -6698,9 +6696,8 @@ static int dm_crtc_helper_atomic_check(struct 
>> drm_crtc *crtc,
>>         dm_update_crtc_active_planes(crtc, crtc_state);
>>   -    if (unlikely(!dm_crtc_state->stream &&
>> -             modeset_required(crtc_state, NULL, 
>> dm_crtc_state->stream))) {
>> -        WARN_ON(1);
>> +    if (WARN_ON(unlikely(!dm_crtc_state->stream &&
>> +             modeset_required(crtc_state, NULL, 
>> dm_crtc_state->stream)))) {
>>           return ret;
>>       }
>


More information about the amd-gfx mailing list