[PATCH] drm/amd/display: Trigger bug when allocation fails.

Tom St Denis tom.stdenis at amd.com
Tue Oct 17 21:11:31 UTC 2017


I'm ok with not pushing my commit and simply adding an else branch that 
sets the pointer to NULL.

(maybe put a WARN_ON to give context?)

Tom

On 17/10/17 04:42 PM, Andrey Grodzovsky wrote:
> 
> 
> On 10/17/2017 04:12 PM, Nicolai Hähnle wrote:
>> On 17.10.2017 19:45, Tom St Denis wrote:
>>> If the allocation fails in amdgpu_dm_connector_funcs_reset() the
>>> API cannot continue so trigger a BUG_ON.
>>
>> That seems questionable to be honest. The drm_atomic_helper version of 
>> this function ends up setting connector->state = NULL; in this case.
> 
> I see it now, it will propagate back to user mode as -ENOMEM, so i guess 
> it's good just set it as NULL.
> 
> Thanks,
> Andrey
> 
>>
>> Cheers,
>> Nicolai
>>
>>>
>>> Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> 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 58e29a2a5ca6..ac58ba4f10cf 100644
>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> @@ -2722,6 +2722,7 @@ void amdgpu_dm_connector_funcs_reset(struct 
>>> drm_connector *connector)
>>>       kfree(state);
>>>         state = kzalloc(sizeof(*state), GFP_KERNEL);
>>> +    BUG_ON(state == NULL);
>>>         if (state) {
>>>           state->scaling = RMX_OFF;
>>>
>>
>>
> 



More information about the amd-gfx mailing list