* [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init()
@ 2023-02-24 17:25 Nathan Chancellor
2023-02-27 9:01 ` Thomas Zimmermann
2023-02-28 9:14 ` Thomas Zimmermann
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2023-02-24 17:25 UTC (permalink / raw)
To: tomba, airlied, daniel, javierm, tzimmermann
Cc: ndesaulniers, trix, dri-devel, linux-kernel, llvm, patches,
kernel test robot, Nathan Chancellor
Clang warns (or errors with CONFIG_WERROR):
../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:6: error: variable 'helper' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (!fbdev)
^~~~~~
../drivers/gpu/drm/omapdrm/omap_fbdev.c:259:26: note: uninitialized use occurs here
drm_fb_helper_unprepare(helper);
^~~~~~
../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:2: note: remove the 'if' if its condition is always false
if (!fbdev)
^~~~~~~~~~~
../drivers/gpu/drm/omapdrm/omap_fbdev.c:228:30: note: initialize the variable 'helper' to silence this warning
struct drm_fb_helper *helper;
^
= NULL
1 error generated.
Return early, as there is nothing for the function to do if memory
cannot be allocated. There is no point in adding another label to just
emit the warning at the end of the function in this case, as memory
allocation failures are already logged.
Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()")
Link: https://github.com/ClangBuiltLinux/linux/issues/1809
Link: https://lore.kernel.org/oe-kbuild-all/202302250058.fYTe9aTP-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This is currently showing in mainline so I believe this should go to
drm-misc-next-fixes.
---
drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 84429728347f..a6c8542087ec 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -233,7 +233,7 @@ void omap_fbdev_init(struct drm_device *dev)
fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
if (!fbdev)
- goto fail;
+ return;
INIT_WORK(&fbdev->work, pan_worker);
---
base-commit: e034b8a18d4badceecb672c58b488bad1e901d95
change-id: 20230224-omapdrm-wsometimes-uninitialized-0125f7692fbb
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init()
2023-02-24 17:25 [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init() Nathan Chancellor
@ 2023-02-27 9:01 ` Thomas Zimmermann
2023-02-27 13:48 ` Tomi Valkeinen
2023-02-28 9:14 ` Thomas Zimmermann
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Zimmermann @ 2023-02-27 9:01 UTC (permalink / raw)
To: Nathan Chancellor, tomba, airlied, daniel, javierm
Cc: ndesaulniers, trix, dri-devel, linux-kernel, llvm, patches,
kernel test robot
[-- Attachment #1.1: Type: text/plain, Size: 2788 bytes --]
Hi
Am 24.02.23 um 18:25 schrieb Nathan Chancellor:
> Clang warns (or errors with CONFIG_WERROR):
>
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:6: error: variable 'helper' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (!fbdev)
> ^~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:259:26: note: uninitialized use occurs here
> drm_fb_helper_unprepare(helper);
> ^~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:2: note: remove the 'if' if its condition is always false
> if (!fbdev)
> ^~~~~~~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:228:30: note: initialize the variable 'helper' to silence this warning
> struct drm_fb_helper *helper;
> ^
> = NULL
> 1 error generated.
>
> Return early, as there is nothing for the function to do if memory
> cannot be allocated. There is no point in adding another label to just
> emit the warning at the end of the function in this case, as memory
> allocation failures are already logged.
>
> Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1809
> Link: https://lore.kernel.org/oe-kbuild-all/202302250058.fYTe9aTP-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> This is currently showing in mainline so I believe this should go to
> drm-misc-next-fixes.
This tree is only active from -rc6 to sometime during the merge window.
I'll add your patch to drm-misc-fixes ASAP.
Best regards
Thomas
> ---
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 84429728347f..a6c8542087ec 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -233,7 +233,7 @@ void omap_fbdev_init(struct drm_device *dev)
>
> fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
> if (!fbdev)
> - goto fail;
> + return;
>
> INIT_WORK(&fbdev->work, pan_worker);
>
>
> ---
> base-commit: e034b8a18d4badceecb672c58b488bad1e901d95
> change-id: 20230224-omapdrm-wsometimes-uninitialized-0125f7692fbb
>
> Best regards,
--
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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init()
2023-02-27 9:01 ` Thomas Zimmermann
@ 2023-02-27 13:48 ` Tomi Valkeinen
0 siblings, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2023-02-27 13:48 UTC (permalink / raw)
To: Thomas Zimmermann, Nathan Chancellor, airlied, daniel, javierm
Cc: ndesaulniers, trix, dri-devel, linux-kernel, llvm, patches,
kernel test robot
On 27/02/2023 11:01, Thomas Zimmermann wrote:
> Hi
>
> Am 24.02.23 um 18:25 schrieb Nathan Chancellor:
>> Clang warns (or errors with CONFIG_WERROR):
>>
>> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:6: error: variable
>> 'helper' is used uninitialized whenever 'if' condition is true
>> [-Werror,-Wsometimes-uninitialized]
>> if (!fbdev)
>> ^~~~~~
>> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:259:26: note: uninitialized
>> use occurs here
>> drm_fb_helper_unprepare(helper);
>> ^~~~~~
>> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:2: note: remove the
>> 'if' if its condition is always false
>> if (!fbdev)
>> ^~~~~~~~~~~
>> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:228:30: note: initialize
>> the variable 'helper' to silence this warning
>> struct drm_fb_helper *helper;
>> ^
>> = NULL
>> 1 error generated.
>>
>> Return early, as there is nothing for the function to do if memory
>> cannot be allocated. There is no point in adding another label to just
>> emit the warning at the end of the function in this case, as memory
>> allocation failures are already logged.
>>
>> Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare()
>> from drm_fb_helper_fini()")
>> Link: https://github.com/ClangBuiltLinux/linux/issues/1809
>> Link:
>> https://lore.kernel.org/oe-kbuild-all/202302250058.fYTe9aTP-lkp@intel.com/
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>
>> ---
>> This is currently showing in mainline so I believe this should go to
>> drm-misc-next-fixes.
>
> This tree is only active from -rc6 to sometime during the merge window.
> I'll add your patch to drm-misc-fixes ASAP.
If it's not too late:
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tomi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init()
2023-02-24 17:25 [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init() Nathan Chancellor
2023-02-27 9:01 ` Thomas Zimmermann
@ 2023-02-28 9:14 ` Thomas Zimmermann
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Zimmermann @ 2023-02-28 9:14 UTC (permalink / raw)
To: Nathan Chancellor, tomba, airlied, daniel, javierm
Cc: kernel test robot, trix, llvm, ndesaulniers, linux-kernel,
dri-devel, patches
[-- Attachment #1.1: Type: text/plain, Size: 2610 bytes --]
Added to drm-misc-next-fixes.
Am 24.02.23 um 18:25 schrieb Nathan Chancellor:
> Clang warns (or errors with CONFIG_WERROR):
>
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:6: error: variable 'helper' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (!fbdev)
> ^~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:259:26: note: uninitialized use occurs here
> drm_fb_helper_unprepare(helper);
> ^~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:235:2: note: remove the 'if' if its condition is always false
> if (!fbdev)
> ^~~~~~~~~~~
> ../drivers/gpu/drm/omapdrm/omap_fbdev.c:228:30: note: initialize the variable 'helper' to silence this warning
> struct drm_fb_helper *helper;
> ^
> = NULL
> 1 error generated.
>
> Return early, as there is nothing for the function to do if memory
> cannot be allocated. There is no point in adding another label to just
> emit the warning at the end of the function in this case, as memory
> allocation failures are already logged.
>
> Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1809
> Link: https://lore.kernel.org/oe-kbuild-all/202302250058.fYTe9aTP-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> This is currently showing in mainline so I believe this should go to
> drm-misc-next-fixes.
> ---
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 84429728347f..a6c8542087ec 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -233,7 +233,7 @@ void omap_fbdev_init(struct drm_device *dev)
>
> fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
> if (!fbdev)
> - goto fail;
> + return;
>
> INIT_WORK(&fbdev->work, pan_worker);
>
>
> ---
> base-commit: e034b8a18d4badceecb672c58b488bad1e901d95
> change-id: 20230224-omapdrm-wsometimes-uninitialized-0125f7692fbb
>
> Best regards,
--
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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-28 9:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 17:25 [PATCH] drm: omapdrm: Do not use helper unininitialized in omap_fbdev_init() Nathan Chancellor
2023-02-27 9:01 ` Thomas Zimmermann
2023-02-27 13:48 ` Tomi Valkeinen
2023-02-28 9:14 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®