Skip to contentSkip to conversation

drm: omapdrm: silence unititialized variable warning

PATCH In review Dan Carpenter 2 participants 2 messages Apr 18, 2018 – May 2, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: omapdrm: silence unititialized variable warning

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.

drivers/gpu/drm/omapdrm/tcm-sita.c +1 -1
index d7f7bc9f061a..817be3c41863 100644
@@ -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;
#1 lore raw

Hi,

Quoted 14 lines · Dan Carpenter

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.

drivers/gpu/drm/omapdrm/tcm-sita.c +0 -0
index d7f7bc9f061a..817be3c41863 100644

drivers/gpu/drm/omapdrm/tcm-sita.c static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset, · line 96

Quoted 8 lines
drivers/gpu/drm/omapdrm/tcm-sita.c +1 -1
@@ -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

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