9
0
Fork 0

don't cast negative error codes to unsigned size_t

The cast prevents us from doing proper error checking.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-04-21 15:50:34 +02:00 committed by Sascha Hauer
parent 521ffee526
commit 4ab9051bd3
2 changed files with 4 additions and 4 deletions

View File

@ -74,7 +74,7 @@ void uimage_print_contents(struct uimage_handle *handle)
} }
EXPORT_SYMBOL(uimage_print_contents); 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) if (image_no >= handle->nb_data_entries)
return -EINVAL; return -EINVAL;
@ -373,7 +373,7 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)
struct resource *res; struct resource *res;
size_t size = BUFSIZ; size_t size = BUFSIZ;
size_t ofs = 0; size_t ofs = 0;
size_t now; ssize_t now;
int fd; int fd;
fd = open(filename, O_RDONLY); 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 image_no, unsigned long load_address)
{ {
int ret; int ret;
size_t size; ssize_t size;
resource_size_t start = (resource_size_t)load_address; resource_size_t start = (resource_size_t)load_address;
uimage_buf = (void *)load_address; uimage_buf = (void *)load_address;

View File

@ -230,7 +230,7 @@ int uimage_verify(struct uimage_handle *handle);
int uimage_load(struct uimage_handle *handle, unsigned int image_no, int uimage_load(struct uimage_handle *handle, unsigned int image_no,
int(*flush)(void*, unsigned int)); int(*flush)(void*, unsigned int));
void uimage_print_contents(struct uimage_handle *handle); 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, struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
int image_no, unsigned long load_address); int image_no, unsigned long load_address);
void *uimage_load_to_buf(struct uimage_handle *handle, int image_no, void *uimage_load_to_buf(struct uimage_handle *handle, int image_no,