[PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux