All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: "Daniel Vetter" <daniel@ffwll.ch>,
	"Jérémy Lefaure" <jeremy.lefaure@lse.epita.fr>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: fix compilation warnings on maybe uninitialized pointers
Date: Tue, 29 Nov 2016 09:10:16 +0000	[thread overview]
Message-ID: <e73501b2-7bc6-7290-eea2-05af673ea158@linux.intel.com> (raw)
In-Reply-To: <20161129085609.m2ippct3ek2nmaiu@phenom.ffwll.local>


On 29/11/2016 08:56, Daniel Vetter wrote:
> On Mon, Nov 28, 2016 at 06:43:19PM -0500, Jérémy Lefaure wrote:
>> Two warnings are produced by gcc (tested with gcc 6.2.1):
>>
>> drivers/gpu/drm/i915/intel_csr.c: In function ‘csr_load_work_fn’:
>> drivers/gpu/drm/i915/intel_csr.c:400:5: error: ‘fw’ is used
>> uninitialized in this function [-Werror=uninitialized]
>>   if (fw)
>>        ^
>> and
>>
>> In file included from drivers/gpu/drm/i915/i915_drv.h:47:0,
>>                  from drivers/gpu/drm/i915/intel_guc_loader.c:30:
>> drivers/gpu/drm/i915/intel_guc_loader.c: In function ‘intel_guc_init’:
>> ./include/drm/drmP.h:228:2: error: ‘fw’ may be used uninitialized in this
>> function  -Werror=maybe-uninitialized]
>>   drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>>   ^~~~~~~~~~
>> drivers/gpu/drm/i915/intel_guc_loader.c:595:25: note: ‘fw’ was declared here
>>   const struct firmware *fw;
>>                          ^~
>>
>> When CONFIG_DRM_I915_WERROR is set, those warnings break the build.
>>
>> Initializing fw pointer to NULL in both cases removes the warnings.
>>
>> Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
>
> Queued for -next, thanks for the patch.

I just wanted to reply with two things; first who can figure out why 
this hasn't been picked up by the compiler before? Or why GCC 6.2.1 on 
my machine does not complain? Looks like a real mystery!

And secondly the csr loader is not even checking the return code. I was 
about to suggest a v2 but never mind now. Can do it myself.

Regards,

Tvrtko

> -Daniel
>
>> ---
>>  drivers/gpu/drm/i915/intel_csr.c        | 2 +-
>>  drivers/gpu/drm/i915/intel_guc_loader.c | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
>> index d7a04bc..3520b3c 100644
>> --- a/drivers/gpu/drm/i915/intel_csr.c
>> +++ b/drivers/gpu/drm/i915/intel_csr.c
>> @@ -389,7 +389,7 @@ static void csr_load_work_fn(struct work_struct *work)
>>  {
>>  	struct drm_i915_private *dev_priv;
>>  	struct intel_csr *csr;
>> -	const struct firmware *fw;
>> +	const struct firmware *fw = NULL;
>>  	int ret;
>>
>>  	dev_priv = container_of(work, typeof(*dev_priv), csr.work);
>> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
>> index 34d6ad2..ecfee49 100644
>> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
>> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
>> @@ -592,7 +592,7 @@ static void guc_fw_fetch(struct drm_device *dev, struct intel_guc_fw *guc_fw)
>>  {
>>  	struct pci_dev *pdev = dev->pdev;
>>  	struct drm_i915_gem_object *obj;
>> -	const struct firmware *fw;
>> +	const struct firmware *fw = NULL;
>>  	struct guc_css_header *css;
>>  	size_t size;
>>  	int err;
>> --
>> 2.10.2
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-11-29  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 23:43 [PATCH] drm/i915: fix compilation warnings on maybe uninitialized pointers Jérémy Lefaure
2016-11-29  0:19 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-11-29  8:56 ` [Intel-gfx] [PATCH] " Daniel Vetter
2016-11-29  9:10   ` Tvrtko Ursulin [this message]
2016-11-29 10:45 ` ✓ Fi.CI.BAT: success for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e73501b2-7bc6-7290-eea2-05af673ea158@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jeremy.lefaure@lse.epita.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.