Skip to contentSkip to conversation

microblaze: Correct build error in eth-uclass.c

PATCH New Simon Glass 4 participants 18 messages Jan 30, 2016 – Feb 6, 2016

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

PATCH 1/6 microblaze: Correct build error in eth-uclass.c

This fixes the following error when building microblaze-generic:

net/eth-uclass.c: In function 'eth_post_probe':
net/eth-uclass.c:466:18: error: 'gd' undeclared (first use in this function)

    ops->start += gd->reloc_off;
Fixes db9391e1 ("net: Move driver-model code into its own file")

---

 net/eth-uclass.c | 2 ++
 1 file changed, 2 insertions(+)
net/eth-uclass.c +2 -0
index a356a08..c15cc4d 100644
@@ -14,6 +14,8 @@
 #include <dm/uclass-internal.h>
 #include "eth_internal.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /**
  * struct eth_device_priv - private structure for each Ethernet device
  *
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#1 lore raw

PATCH 2/6 cmd: Fix control bmp_display()

All paths should share the same return.

Reported-by Coverity (CID:134903)

---

 cmd/bmp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
cmd/bmp.c +1 -2
index fd5b7db..01b3d39 100644
@@ -259,7 +259,6 @@ int bmp_display(ulong addr, int x, int y)
 			ret = video_bmp_display(dev, addr, x, y, align);
 		}
 	}
-	return ret ? CMD_RET_FAILURE : 0;
 #elif defined(CONFIG_LCD)
 	ret = lcd_display_bitmap(addr, x, y);
 #elif defined(CONFIG_VIDEO)
@@ -271,5 +270,5 @@ int bmp_display(ulong addr, int x, int y)
 	if (bmp_alloc_addr)
 		free(bmp_alloc_addr);
 
-	return ret;
+	return ret ? CMD_RET_FAILURE : 0;
 }
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#2 lore raw

PATCH 2/6 cmd: Fix control bmp_display()

Quoted 5 lines · Simon Glass

All paths should share the same return.

Reported-by Coverity (CID:134903)
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160201/9150b8bc/attachment.sig>
#3 lore raw

PATCH 2/6 cmd: Fix control bmp_display()

In reply to Simon Glass
Quoted 9 lines · On Sat, 30 Jan 2016 15:45:15 -0700 Simon Glass sjg at chromium.org wrote:

All paths should share the same return.

Reported-by Coverity (CID:134903)

---

 cmd/bmp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

applied to u-boot-staging, thanks!

--
Anatolij

#4 lore raw

PATCH 3/6 video: Use 'int' for loop variables instead of short

In reply to Simon Glass

Using short doesn't save anything and is confusing when the width and height variables are ulong.

This may fix Coverity CID134902 but I doubt it.

---

 drivers/video/video_bmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/video_bmp.c +1 -1
index c9075d6..fb7943e 100644
@@ -194,7 +194,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 {
 	struct video_priv *priv = dev_get_uclass_priv(dev);
 	ushort *cmap_base = NULL;
-	ushort i, j;
+	int i, j;
 	uchar *fb;
 	struct bmp_image *bmp = map_sysmem(bmp_image, 0);
 	uchar *bmap;
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#5 lore raw

PATCH 3/6 video: Use 'int' for loop variables instead of short

Quoted 4 lines · Simon Glass

Using short doesn't save anything and is confusing when the width and height variables are ulong.

This may fix Coverity CID134902 but I doubt it.

It won't, that CID wants height to be sanity checked as it comes from an external source and we don't make sure it has a valid value, as far as coverity thinks at least. If you're happy with:

        if ((x + width) > pwidth)
                width = pwidth - x;
        if ((y + height) > priv->ysize)
                height = priv->ysize - y;

Being sufficient sanity checking on both, I can close the defect out as a false positive. Thanks!

Quoted 2 lines
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160201/49f48a07/attachment.sig>
#6 lore raw

PATCH 3/6 video: Use 'int' for loop variables instead of short

In reply to Simon Glass
Quoted 10 lines · On Sat, 30 Jan 2016 15:45:16 -0700 Simon Glass sjg at chromium.org wrote:

Using short doesn't save anything and is confusing when the width and height variables are ulong.

This may fix Coverity CID134902 but I doubt it.

---

 drivers/video/video_bmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-staging, thanks!

--
Anatolij

#7 lore raw

PATCH 4/6 video: test: Adjust order of file closure

In reply to Simon Glass

Close the file earlier to hopefully fix a Coverity error.

Reported-by Coverity (CID: 134901)

---

 test/dm/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/dm/video.c +1 -1
index de22328..4d000fa 100644
@@ -249,9 +249,9 @@ static int read_file(struct unit_test_state *uts, const char *fname,
 	fd = os_open(fname, OS_O_RDONLY);
 	ut_assert(fd >= 0);
 	size = os_read(fd, buf, buf_size);
+	os_close(fd);
 	ut_assert(size >= 0);
 	ut_assert(size < buf_size);
-	os_close(fd);
 	*addrp = addr;
 
 	return 0;
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#8 lore raw

PATCH 4/6 video: test: Adjust order of file closure

Quoted 5 lines · Simon Glass

Close the file earlier to hopefully fix a Coverity error.

Reported-by Coverity (CID: 134901)
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160201/a810f9b5/attachment.sig>
#9 lore raw

PATCH 4/6 video: test: Adjust order of file closure

In reply to Simon Glass
Quoted 9 lines · On Sat, 30 Jan 2016 15:45:17 -0700 Simon Glass sjg at chromium.org wrote:

Close the file earlier to hopefully fix a Coverity error.

Reported-by Coverity (CID: 134901)

---

 test/dm/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-staging, thanks!

--
Anatolij

#10 lore raw

PATCH 5/6 bzlib: Try another way to fix an unused variable

In reply to Simon Glass

Use __maybe_unused which should avoid the Coverity error.

Reported-by Coverity (CID: 134900)

---

 lib/bzip2/bzlib_compress.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/bzip2/bzlib_compress.c +3 -4
index c8da1c7..68d948b 100644
@@ -67,7 +67,7 @@
 */
 
 #include "bzlib_private.h"
-
+#include <compiler.h>
 
 /*---------------------------------------------------*/
 /*--- Bit stream I/O                              ---*/
@@ -280,7 +280,8 @@ void sendMTFValues ( EState* s )
 {
    Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
    Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
-   Int32 nGroups, nBytes;
+   Int32 nGroups;
+   Int32 nBytes __maybe_unused;
 
    /*--
    UChar  len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
@@ -635,8 +636,6 @@ void sendMTFValues ( EState* s )
 
    if (s->verbosity >= 3)
       VPrintf1( "codes %d\n", s->numZ-nBytes );
-   else /* squash compiler 'used but not set' warning */
-      nBytes = nBytes;
 }
 
 
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#11 lore raw

PATCH 5/6 bzlib: Try another way to fix an unused variable

Quoted 5 lines · Simon Glass

Use __maybe_unused which should avoid the Coverity error.

Reported-by Coverity (CID: 134900)
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160201/e711865a/attachment.sig>
#12 lore raw

PATCH 5/6 bzlib: Try another way to fix an unused variable

In reply to Simon Glass
Quoted 9 lines · On Sat, 30 Jan 2016 15:45:18 -0700 Simon Glass sjg at chromium.org wrote:

Use __maybe_unused which should avoid the Coverity error.

Reported-by Coverity (CID: 134900)

---

 lib/bzip2/bzlib_compress.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

applied to u-boot-staging, thanks!

--
Anatolij

#13 lore raw

PATCH 6/6 rockchip: Drop old CONFIG_VIDEO_ROTATION option

In reply to Simon Glass

The option was renamed to CONFIG_CONSOLE_ROTATION and Rockchip boards were not updated. However this option is is not needed by default for Rockchip since we don't need a rotated console for current boards. So just remove the old option.

---

 configs/chromebook_jerry_defconfig | 1 -
 configs/firefly-rk3288_defconfig   | 1 -
 configs/rock2_defconfig            | 1 -
 3 files changed, 3 deletions(-)
configs/chromebook_jerry_defconfig +0 -1
index bd8b964..390b2ec 100644
@@ -57,7 +57,6 @@ CONFIG_ROCKCHIP_SPI=y
 CONFIG_DM_VIDEO=y
 CONFIG_I2C_EDID=y
 CONFIG_DISPLAY=y
-CONFIG_VIDEO_ROTATION=y
 CONFIG_VIDEO_ROCKCHIP=y
 CONFIG_USE_PRIVATE_LIBGCC=y
 CONFIG_USE_TINY_PRINTF=y
configs/firefly-rk3288_defconfig +0 -1
index 3b29158..5aa4166 100644
@@ -49,7 +49,6 @@ CONFIG_SYS_NS16550=y
 CONFIG_DM_VIDEO=y
 CONFIG_I2C_EDID=y
 CONFIG_DISPLAY=y
-CONFIG_VIDEO_ROTATION=y
 CONFIG_VIDEO_ROCKCHIP=y
 CONFIG_USE_PRIVATE_LIBGCC=y
 CONFIG_USE_TINY_PRINTF=y
configs/rock2_defconfig +0 -1
index 68e3b36..f33daf1 100644
@@ -47,7 +47,6 @@ CONFIG_SYS_NS16550=y
 CONFIG_DM_VIDEO=y
 CONFIG_I2C_EDID=y
 CONFIG_DISPLAY=y
-CONFIG_VIDEO_ROTATION=y
 CONFIG_VIDEO_ROCKCHIP=y
 CONFIG_USE_PRIVATE_LIBGCC=y
 CONFIG_USE_TINY_PRINTF=y
Signature · 1 line
2.7.0.rc3.207.g0ac5344
#14 lore raw

PATCH 6/6 rockchip: Drop old CONFIG_VIDEO_ROTATION option

Quoted 6 lines · Simon Glass

The option was renamed to CONFIG_CONSOLE_ROTATION and Rockchip boards were not updated. However this option is is not needed by default for Rockchip since we don't need a rotated console for current boards. So just remove the old option.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160201/68f7d8ce/attachment.sig>
#15 lore raw

PATCH 6/6 rockchip: Drop old CONFIG_VIDEO_ROTATION option

In reply to Simon Glass
Quoted 5 lines · On Sat, 30 Jan 2016 15:45:19 -0700 Simon Glass sjg at chromium.org wrote:

The option was renamed to CONFIG_CONSOLE_ROTATION and Rockchip boards were not updated. However this option is is not needed by default for Rockchip since we don't need a rotated console for current boards. So just remove the old option.

Quoted 7 lines

---

 configs/chromebook_jerry_defconfig | 1 -
 configs/firefly-rk3288_defconfig   | 1 -
 configs/rock2_defconfig            | 1 -
 3 files changed, 3 deletions(-)

applied to u-boot-staging, thanks!

--
Anatolij

#16 lore raw

PATCH 1/6 microblaze: Correct build error in eth-uclass.c

In reply to Simon Glass

Hi Simon,

Quoted 10 lines · Simon Glass

This fixes the following error when building microblaze-generic:

net/eth-uclass.c: In function 'eth_post_probe':
net/eth-uclass.c:466:18: error: 'gd' undeclared (first use in this function)

    ops->start += gd->reloc_off;
Fixes db9391e1 ("net: Move driver-model code into its own file")

---

That didn't show up in my regression build test because microblaze was already broken for me.

#17 lore raw

PATCH 1/6 microblaze: Correct build error in eth-uclass.c

In reply to Simon Glass

Hi Simon,

Quoted 6 lines · On Sat, 30 Jan 2016 15:45:14 -0700 Simon Glass sjg at chromium.org wrote:

This fixes the following error when building microblaze-generic:

net/eth-uclass.c: In function 'eth_post_probe':
net/eth-uclass.c:466:18: error: 'gd' undeclared (first use in this function)

    ops->start += gd->reloc_off;
Quoted 7 lines
Fixes db9391e1 ("net: Move driver-model code into its own file")

---

 net/eth-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to u-boot-staging, thanks!

--
Anatolij