[U-Boot] [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")
Signed-off-by: Simon Glass sjg@chromium.org ---
net/eth-uclass.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/net/eth-uclass.c b/net/eth-uclass.c index a356a08..c15cc4d 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -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 *

All paths should share the same return.
Reported-by: Coverity (CID:134903)
Signed-off-by: Simon Glass sjg@chromium.org ---
cmd/bmp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cmd/bmp.c b/cmd/bmp.c index fd5b7db..01b3d39 100644 --- a/cmd/bmp.c +++ b/cmd/bmp.c @@ -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; }

On Sat, Jan 30, 2016 at 03:45:15PM -0700, Simon Glass wrote:
All paths should share the same return.
Reported-by: Coverity (CID:134903)
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Tom Rini trini@konsulko.com

On Sat, 30 Jan 2016 15:45:15 -0700 Simon Glass sjg@chromium.org wrote:
All paths should share the same return.
Reported-by: Coverity (CID:134903)
Signed-off-by: Simon Glass sjg@chromium.org
cmd/bmp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
applied to u-boot-staging, thanks!
-- Anatolij

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.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/video/video_bmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index c9075d6..fb7943e 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -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;

On Sat, Jan 30, 2016 at 03:45:16PM -0700, Simon Glass 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.
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!
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Tom Rini trini@konsulko.com

On Sat, 30 Jan 2016 15:45:16 -0700 Simon Glass sjg@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.
Signed-off-by: Simon Glass sjg@chromium.org
drivers/video/video_bmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-staging, thanks!
-- Anatolij

Close the file earlier to hopefully fix a Coverity error.
Reported-by: Coverity (CID: 134901)
Signed-off-by: Simon Glass sjg@chromium.org ---
test/dm/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/dm/video.c b/test/dm/video.c index de22328..4d000fa 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -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;

On Sat, Jan 30, 2016 at 03:45:17PM -0700, Simon Glass wrote:
Close the file earlier to hopefully fix a Coverity error.
Reported-by: Coverity (CID: 134901)
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Tom Rini trini@konsulko.com

On Sat, 30 Jan 2016 15:45:17 -0700 Simon Glass sjg@chromium.org wrote:
Close the file earlier to hopefully fix a Coverity error.
Reported-by: Coverity (CID: 134901)
Signed-off-by: Simon Glass sjg@chromium.org
test/dm/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-staging, thanks!
-- Anatolij

Use __maybe_unused which should avoid the Coverity error.
Reported-by: Coverity (CID: 134900)
Signed-off-by: Simon Glass sjg@chromium.org ---
lib/bzip2/bzlib_compress.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/bzip2/bzlib_compress.c b/lib/bzip2/bzlib_compress.c index c8da1c7..68d948b 100644 --- a/lib/bzip2/bzlib_compress.c +++ b/lib/bzip2/bzlib_compress.c @@ -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; }

On Sat, Jan 30, 2016 at 03:45:18PM -0700, Simon Glass wrote:
Use __maybe_unused which should avoid the Coverity error.
Reported-by: Coverity (CID: 134900)
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Tom Rini trini@konsulko.com

On Sat, 30 Jan 2016 15:45:18 -0700 Simon Glass sjg@chromium.org wrote:
Use __maybe_unused which should avoid the Coverity error.
Reported-by: Coverity (CID: 134900)
Signed-off-by: Simon Glass sjg@chromium.org
lib/bzip2/bzlib_compress.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
applied to u-boot-staging, thanks!
-- Anatolij

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.
Signed-off-by: Simon Glass sjg@chromium.org ---
configs/chromebook_jerry_defconfig | 1 - configs/firefly-rk3288_defconfig | 1 - configs/rock2_defconfig | 1 - 3 files changed, 3 deletions(-)
diff --git a/configs/chromebook_jerry_defconfig b/configs/chromebook_jerry_defconfig index bd8b964..390b2ec 100644 --- a/configs/chromebook_jerry_defconfig +++ b/configs/chromebook_jerry_defconfig @@ -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 diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index 3b29158..5aa4166 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -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 diff --git a/configs/rock2_defconfig b/configs/rock2_defconfig index 68e3b36..f33daf1 100644 --- a/configs/rock2_defconfig +++ b/configs/rock2_defconfig @@ -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

On Sat, Jan 30, 2016 at 03:45:19PM -0700, Simon Glass 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.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Tom Rini trini@konsulko.com

On Sat, 30 Jan 2016 15:45:19 -0700 Simon Glass sjg@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.
Signed-off-by: Simon Glass sjg@chromium.org
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

Hi Simon,
On Sat, Jan 30, 2016 at 4:45 PM, Simon Glass sjg@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;
Fixes: db9391e1 ("net: Move driver-model code into its own file")
Signed-off-by: Simon Glass sjg@chromium.org
That didn't show up in my regression build test because microblaze was already broken for me.
Acked-by: Joe Hershberger joe.hershberger@ni.com

Hi Simon,
On Sat, 30 Jan 2016 15:45:14 -0700 Simon Glass sjg@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;
Fixes: db9391e1 ("net: Move driver-model code into its own file")
Signed-off-by: Simon Glass sjg@chromium.org
net/eth-uclass.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-staging, thanks!
-- Anatolij
participants (4)
-
Anatolij Gustschin
-
Joe Hershberger
-
Simon Glass
-
Tom Rini