LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drm: omapdrm: silence unititialized variable warning
@ 2018-04-18 14:29 Dan Carpenter
  2018-05-02  8:59 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-04-18 14:29 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: David Airlie, dri-devel, linux-kernel, kernel-janitors

Smatch complains that "area_free" could be used without being
initialized.  This code is several years old and premusably works fine
so this can't be a very serious bug.  But it's easy enough to silence
the warning.  If "area_free" is false at the end of the function then
we return -ENOMEM.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/omapdrm/tcm-sita.c b/drivers/gpu/drm/omapdrm/tcm-sita.c
index d7f7bc9f061a..817be3c41863 100644
--- a/drivers/gpu/drm/omapdrm/tcm-sita.c
+++ b/drivers/gpu/drm/omapdrm/tcm-sita.c
@@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset,
 {
 	int i;
 	unsigned long index;
-	bool area_free;
+	bool area_free = false;
 	unsigned long slots_per_band = PAGE_SIZE / slot_bytes;
 	unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0;
 	unsigned long curr_bit = bit_offset;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm: omapdrm: silence unititialized variable warning
  2018-04-18 14:29 [PATCH] drm: omapdrm: silence unititialized variable warning Dan Carpenter
@ 2018-05-02  8:59 ` Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2018-05-02  8:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David Airlie, dri-devel, linux-kernel, kernel-janitors

Hi,

On 18/04/18 17:29, Dan Carpenter wrote:
> Smatch complains that "area_free" could be used without being
> initialized.  This code is several years old and premusably works fine
> so this can't be a very serious bug.  But it's easy enough to silence
> the warning.  If "area_free" is false at the end of the function then
> we return -ENOMEM.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/omapdrm/tcm-sita.c b/drivers/gpu/drm/omapdrm/tcm-sita.c
> index d7f7bc9f061a..817be3c41863 100644
> --- a/drivers/gpu/drm/omapdrm/tcm-sita.c
> +++ b/drivers/gpu/drm/omapdrm/tcm-sita.c
> @@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset,
>  {
>  	int i;
>  	unsigned long index;
> -	bool area_free;
> +	bool area_free = false;
>  	unsigned long slots_per_band = PAGE_SIZE / slot_bytes;
>  	unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0;
>  	unsigned long curr_bit = bit_offset;
> 

Thanks, I've queued this for 4.17 fixes.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-02  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 14:29 [PATCH] drm: omapdrm: silence unititialized variable warning Dan Carpenter
2018-05-02  8:59 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).