[PATCH 09/14] drm/msm: Fix sparse warnings

Emil Velikov emil.l.velikov at gmail.com
Mon Sep 19 16:01:23 UTC 2016


On 19 September 2016 at 16:33, Jani Nikula <jani.nikula at linux.intel.com> wrote:
> On Mon, 19 Sep 2016, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 19 September 2016 at 14:33,  <ville.syrjala at linux.intel.com> wrote:
>>
>>> --- a/drivers/gpu/drm/msm/msm_fb.c
>>> +++ b/drivers/gpu/drm/msm/msm_fb.c
>>> @@ -132,7 +132,7 @@ const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb)
>>>  struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
>>>                 struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd)
>>>  {
>>> -       struct drm_gem_object *bos[4] = {0};
>>> +       struct drm_gem_object *bos[4] = {};
>> Fwiw I was reminded using empty initializers isn't standard C [1].
>
> Well, meh, we're not doing -std=c11 -pedantic. Arguably {} is neater.
>
> I guess the commit message lacks the sparse warning about using plain
> integer 0 as NULL pointer.
>
Ack. Just pointing it out for people, who weren't familiar. Fwiw this
is one of the bigger bikesheding topics I've seen, esp. since
different compiler (versions) produce warnings for each permutation
:-\

Sparse shouldn't produce warning since the spec explicitly states that
0 should be 'good enough' for anyone ;-)

Regards,
Emil


More information about the dri-devel mailing list