[PATCH] drm: Avoid calling dev_printk(.dev = NULL)

Sean Paul seanpaul at chromium.org
Mon Aug 22 16:11:00 UTC 2016


On Fri, Aug 19, 2016 at 7:33 AM, Sean Paul <seanpaul at chromium.org> wrote:
> On Aug 19, 2016 12:37 AM, "Chris Wilson" <chris at chris-wilson.co.uk> wrote:
>>
>> Since dev_printk likes to print "(NULL device *):" when passed in a NULL
>> pointer, we have to manually call printk() ourselves.
>>
>> Fixes: c4e68a583202 ("drm: Introduce DRM_DEV_* log messages")
>> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
>> Cc: Eric Engestrom <eric.engestrom at imgtec.com>
>> Cc: Sean Paul <seanpaul at chromium.org>
>
> Thanks for fixing this, Chris.
>
> Reviewed-by: Sean Paul <seanpaul at chromium.org>

Applied to drm-misc

>
>> ---
>>  drivers/gpu/drm/drm_drv.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
>> index a7f628298365..acf6a5f38920 100644
>> --- a/drivers/gpu/drm/drm_drv.c
>> +++ b/drivers/gpu/drm/drm_drv.c
>> @@ -79,8 +79,11 @@ void drm_dev_printk(const struct device *dev, const
>> char *level,
>>         vaf.fmt = format;
>>         vaf.va = &args;
>>
>> -       dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
>> -                  &vaf);
>> +       if (dev)
>> +               dev_printk(level, dev, DRM_PRINTK_FMT, function_name,
>> prefix,
>> +                          &vaf);
>> +       else
>> +               printk("%s" DRM_PRINTK_FMT, level, function_name, prefix,
>> &vaf);
>>
>>         va_end(args);
>>  }
>> --
>> 2.9.3
>>


More information about the dri-devel mailing list