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

Siddh Raman Pant code at siddh.me
Wed Dec 21 15:35:34 UTC 2022


On Wed, Dec 21 2022 at 15:11:07 +0530, Jani Nikula wrote:
> On Wed, 21 Dec 2022, Siddh Raman Pant <code at siddh.me> 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



More information about the dri-devel mailing list