diff mbox series

Silence some trivial compiler warning in the js2x code

Message ID 20211001071010.941684-1-thuth@redhat.com
State Accepted
Headers show
Series Silence some trivial compiler warning in the js2x code | expand

Commit Message

Thomas Huth Oct. 1, 2021, 7:10 a.m. UTC
We enabled additional compiler warnings in commit 26d8ba170355c9, but
so far we did not address the additional warnings in the js2x code
yet. This patch fixes at least some of the trivial warnings there.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 clients/net-snk/kernel/systemcall.c | 2 +-
 clients/net-snk/oflib/of.c          | 2 +-
 lib/libnvram/nvram.c                | 2 +-
 rtas/flash/block_lists.c            | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)

Comments

Alexey Kardashevskiy Oct. 6, 2021, 9:49 a.m. UTC | #1
On 01/10/2021 17:10, Thomas Huth wrote:
> We enabled additional compiler warnings in commit 26d8ba170355c9, but
> so far we did not address the additional warnings in the js2x code
> yet. This patch fixes at least some of the trivial warnings there.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>


Thanks, applied.


> ---
>  clients/net-snk/kernel/systemcall.c | 2 +-
>  clients/net-snk/oflib/of.c          | 2 +-
>  lib/libnvram/nvram.c                | 2 +-
>  rtas/flash/block_lists.c            | 1 +
>  4 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/clients/net-snk/kernel/systemcall.c b/clients/net-snk/kernel/systemcall.c
> index 52c45ca..01d5f2b 100644
> --- a/clients/net-snk/kernel/systemcall.c
> +++ b/clients/net-snk/kernel/systemcall.c
> @@ -120,7 +120,7 @@ ssize_t write (int fd, const void *buf, size_t len)
>  	char dest_buf[512];
>  	char *dest_buf_ptr;
>  	const char *dbuf = buf;
> -	int i;
> +	size_t i;
>  
>  	if (fd == 1 || fd == 2) {
>  		dest_buf_ptr = &dest_buf[0];
> diff --git a/clients/net-snk/oflib/of.c b/clients/net-snk/oflib/of.c
> index 5c502ac..365191c 100644
> --- a/clients/net-snk/oflib/of.c
> +++ b/clients/net-snk/oflib/of.c
> @@ -481,7 +481,7 @@ map_one_range(uint64_t *addr, int type, uint32_t *ranges, uint32_t nac,
>  	uint64_t cm, size, pm;
>  	/* only check for the type if nac == 3 (PCI) */
>  	DEBUG_TR("type %x, nac %x\n", ranges[0], nac);
> -	if (((ranges[0] & 0x03000000) >> 24) != type && nac == 3)
> +	if ((((int)ranges[0] & 0x03000000) >> 24) != type && nac == 3)
>  		return -1;
>  	/* okay, it is the same type let's see if we find a mapping */
>  	size = get_dt_address(ranges + nac + pnac, nsc);
> diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c
> index 6d145d7..048c583 100644
> --- a/lib/libnvram/nvram.c
> +++ b/lib/libnvram/nvram.c
> @@ -269,7 +269,7 @@ static uint8_t calc_partition_header_checksum(int offset)
>  	return checksum;
>  }
>  
> -static int calc_used_nvram_space(void)
> +static unsigned int calc_used_nvram_space(void)
>  {
>  	unsigned walk, len;
>  
> diff --git a/rtas/flash/block_lists.c b/rtas/flash/block_lists.c
> index e632fd0..d632229 100644
> --- a/rtas/flash/block_lists.c
> +++ b/rtas/flash/block_lists.c
> @@ -41,6 +41,7 @@ print_progress(void)
>  		break;
>  	case 0:
>  		printf("\b\\");
> +		/* fallthrough */
>  	default:
>  		i = 3;
>  	}
>
diff mbox series

Patch

diff --git a/clients/net-snk/kernel/systemcall.c b/clients/net-snk/kernel/systemcall.c
index 52c45ca..01d5f2b 100644
--- a/clients/net-snk/kernel/systemcall.c
+++ b/clients/net-snk/kernel/systemcall.c
@@ -120,7 +120,7 @@  ssize_t write (int fd, const void *buf, size_t len)
 	char dest_buf[512];
 	char *dest_buf_ptr;
 	const char *dbuf = buf;
-	int i;
+	size_t i;
 
 	if (fd == 1 || fd == 2) {
 		dest_buf_ptr = &dest_buf[0];
diff --git a/clients/net-snk/oflib/of.c b/clients/net-snk/oflib/of.c
index 5c502ac..365191c 100644
--- a/clients/net-snk/oflib/of.c
+++ b/clients/net-snk/oflib/of.c
@@ -481,7 +481,7 @@  map_one_range(uint64_t *addr, int type, uint32_t *ranges, uint32_t nac,
 	uint64_t cm, size, pm;
 	/* only check for the type if nac == 3 (PCI) */
 	DEBUG_TR("type %x, nac %x\n", ranges[0], nac);
-	if (((ranges[0] & 0x03000000) >> 24) != type && nac == 3)
+	if ((((int)ranges[0] & 0x03000000) >> 24) != type && nac == 3)
 		return -1;
 	/* okay, it is the same type let's see if we find a mapping */
 	size = get_dt_address(ranges + nac + pnac, nsc);
diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c
index 6d145d7..048c583 100644
--- a/lib/libnvram/nvram.c
+++ b/lib/libnvram/nvram.c
@@ -269,7 +269,7 @@  static uint8_t calc_partition_header_checksum(int offset)
 	return checksum;
 }
 
-static int calc_used_nvram_space(void)
+static unsigned int calc_used_nvram_space(void)
 {
 	unsigned walk, len;
 
diff --git a/rtas/flash/block_lists.c b/rtas/flash/block_lists.c
index e632fd0..d632229 100644
--- a/rtas/flash/block_lists.c
+++ b/rtas/flash/block_lists.c
@@ -41,6 +41,7 @@  print_progress(void)
 		break;
 	case 0:
 		printf("\b\\");
+		/* fallthrough */
 	default:
 		i = 3;
 	}