Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Tom Rix <trix@redhat.com>,
	robdclark@gmail.com, quic_abhinavk@quicinc.com,
	dmitry.baryshkov@linaro.org, sean@poorly.run, airlied@gmail.com,
	daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com,
	javierm@redhat.com
Cc: linux-arm-msm@vger.kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org
Subject: Re: [PATCH] drm/msm: return early when allocating fbdev fails
Date: Wed, 22 Feb 2023 17:09:40 +0100	[thread overview]
Message-ID: <8f4a18d7-3477-5af0-605d-27098cc7e02c@suse.de> (raw)
In-Reply-To: <20230222155649.2001467-1-trix@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1481 bytes --]

Hi

Am 22.02.23 um 16:56 schrieb Tom Rix:
> building with clang and W=1 reports
> drivers/gpu/drm/msm/msm_fbdev.c:144:6: error: variable 'helper' is used
>    uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>    if (!fbdev)
>        ^~~~~~
> 
> helper is only initialized after fbdev succeeds, so is in a garbage state at
> the fail: label.  There is nothing to unwinded if fbdev alloaction fails,
> return NULL.
> 
> Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()")
> Signed-off-by: Tom Rix <trix@redhat.com>

Already fixed here: 
https://lore.kernel.org/dri-devel/08e3340e-b459-0e60-4bba-30716b675e05@suse.de/T/#t

Best regards
Thomas

> ---
>   drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
> index c804e5ba682a..c1356aff87da 100644
> --- a/drivers/gpu/drm/msm/msm_fbdev.c
> +++ b/drivers/gpu/drm/msm/msm_fbdev.c
> @@ -142,7 +142,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
>   
>   	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>   	if (!fbdev)
> -		goto fail;
> +		return NULL;
>   
>   	helper = &fbdev->base;
>   

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-02-22 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 15:56 [PATCH] drm/msm: return early when allocating fbdev fails Tom Rix
2023-02-22 16:09 ` Thomas Zimmermann [this message]
2023-02-22 18:21   ` Nathan Chancellor

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=8f4a18d7-3477-5af0-605d-27098cc7e02c@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=trix@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox