[PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files
Felix Kuehling
felix.kuehling at amd.com
Fri May 18 22:12:46 UTC 2018
On 2018-05-18 05:57 PM, Oded Gabbay wrote:
>>> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
>>> +{
>>> + return NULL;
>> I think this will cause an oops in amdgpu_amdkfd_probe because that
>> function doesn't handle kgd2kfd == NULL. You could remove
>> amdgpu_amdkfd_gfx_*_get_functions and instead turn amdgpu_amdkfd_probe
>> itself into a stub to simplify this. That's the only place where
>> *_get_functions are called.
> Actually this function will never be called if amdkfd is not compiled,
> because amdgpu_amdkfd_probe will exit immediately due to the if
> statement at the start of that function (which checks kgd2kfd is not
> NULL).
Ah, I missed that.
> I did see that kgd2kfd is not initialized to NULL in case
> amdkfd is not compiled and I fixed that in v3.
kgd2kfd is global uninitialized data. That should be implicitly
initialized to 0. I've got checkpatch warnings before for initializing
global variables to 0 explicitly. Anyway, doing the initialization
explicitly in the code like you did in v3 doesn't do any harm and it
makes things more clear.
Thanks,
Felix
> I prefer not to add stub for probe because then I will have to #ifdef
> around the real probe function and I prefer to minimize #ifdefs
>
> Oded
More information about the amd-gfx
mailing list