* [PATCH v2 1/2] don't cast negative error codes to unsigned size_t
@ 2014-04-21 13:50 Lucas Stach
2014-04-21 13:50 ` [PATCH v2 2/2] commands: uimage: remove redundant error message Lucas Stach
2014-04-23 7:21 ` [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2014-04-21 13:50 UTC (permalink / raw)
To: barebox
The cast prevents us from doing proper error checking.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
v2: use ssize_t instead of plain int
---
common/uimage.c | 6 +++---
include/image.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/uimage.c b/common/uimage.c
index 7fbef8688e62..243dfb0df5e1 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -74,7 +74,7 @@ void uimage_print_contents(struct uimage_handle *handle)
}
EXPORT_SYMBOL(uimage_print_contents);
-size_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no)
+ssize_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no)
{
if (image_no >= handle->nb_data_entries)
return -EINVAL;
@@ -373,7 +373,7 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)
struct resource *res;
size_t size = BUFSIZ;
size_t ofs = 0;
- size_t now;
+ ssize_t now;
int fd;
fd = open(filename, O_RDONLY);
@@ -420,7 +420,7 @@ struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
int image_no, unsigned long load_address)
{
int ret;
- size_t size;
+ ssize_t size;
resource_size_t start = (resource_size_t)load_address;
uimage_buf = (void *)load_address;
diff --git a/include/image.h b/include/image.h
index 0c8a4b138d94..730e3d75b835 100644
--- a/include/image.h
+++ b/include/image.h
@@ -230,7 +230,7 @@ int uimage_verify(struct uimage_handle *handle);
int uimage_load(struct uimage_handle *handle, unsigned int image_no,
int(*flush)(void*, unsigned int));
void uimage_print_contents(struct uimage_handle *handle);
-size_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no);
+ssize_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no);
struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
int image_no, unsigned long load_address);
void *uimage_load_to_buf(struct uimage_handle *handle, int image_no,
--
1.9.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] commands: uimage: remove redundant error message
2014-04-21 13:50 [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Lucas Stach
@ 2014-04-21 13:50 ` Lucas Stach
2014-04-23 7:21 ` [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2014-04-21 13:50 UTC (permalink / raw)
To: barebox
uimage_verify already prints an error message if the CRC
is wrong. Romove the never reached redundant message in
the caller.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
commands/uimage.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/commands/uimage.c b/commands/uimage.c
index 345e49600c81..bdc74448d9e5 100644
--- a/commands/uimage.c
+++ b/commands/uimage.c
@@ -62,12 +62,9 @@ static int do_uimage(int argc, char *argv[])
if (verify) {
printf("verifying data crc... ");
ret = uimage_verify(handle);
- if (ret) {
+ if (ret)
goto err;
- printf("Bad Data CRC\n");
- } else {
- printf("ok\n");
- }
+ printf("ok\n");
}
if (extract) {
--
1.9.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] don't cast negative error codes to unsigned size_t
2014-04-21 13:50 [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Lucas Stach
2014-04-21 13:50 ` [PATCH v2 2/2] commands: uimage: remove redundant error message Lucas Stach
@ 2014-04-23 7:21 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-04-23 7:21 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Mon, Apr 21, 2014 at 03:50:34PM +0200, Lucas Stach wrote:
> The cast prevents us from doing proper error checking.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-23 7:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 13:50 [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Lucas Stach
2014-04-21 13:50 ` [PATCH v2 2/2] commands: uimage: remove redundant error message Lucas Stach
2014-04-23 7:21 ` [PATCH v2 1/2] don't cast negative error codes to unsigned size_t Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox