Re: [PATCH 04/10] drm/print: Fix support for NULL as first argument of drm_dbg_*

From: Siddh Raman Pant
Date: Wed Dec 21 2022 - 10:38:18 EST


On Wed, Dec 21 2022 at 15:11:07 +0530, Jani Nikula wrote:
> On Wed, 21 Dec 2022, Siddh Raman Pant <code@xxxxxxxx> wrote:
>> Comments say macros DRM_DEBUG_* are deprecated in favor of
>> drm_dbg_*(NULL, ...), but they have broken support for it,
>> as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
>
> What's wrong with that?

NULL is not a struct, so the syntax is incorrect.

Note that this isn't about a dev pointer whose value is
NULL, the first argument is NULL directly. So "NULL" is
directly substituted as is. If it was a dev pointer, then
the definition of struct allowed for no error, but here
gcc will generate the following error:

error: request for member ‘dev’ in something not a structure or union

Hence, there is a need to fix them.

Thanks,
Siddh