[13/27] acpi: crsdump: add in missing pointer constifications
diff mbox series

Message ID 20180815131129.24146-14-colin.king@canonical.com
State Accepted
Headers show
Series
  • [01/27] lib: fwts_framework: ensure src pointer is const
Related show

Commit Message

Colin King Aug. 15, 2018, 1:11 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Fix up some build warnings because of missing const casting

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/crsdump/crsdump.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Alex Hung Aug. 15, 2018, 6:10 p.m. UTC | #1
On 2018-08-15 06:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Fix up some build warnings because of missing const casting
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/crsdump/crsdump.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index abf20ce1..706677c4 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -74,7 +74,7 @@ static void crsdump_show_info(
>   			/*
>   			 *  CRS_BIT*() data
>   			 */
> -			val = (uint64_t)*(uint8_t*)(data + info->offset);
> +			val = (uint64_t)*(const uint8_t *)(data + info->offset);
>   			while (mask && ((mask & 1) == 0)) {
>   				val >>= 1;
>   				mask >>= 1;
> @@ -87,16 +87,16 @@ static void crsdump_show_info(
>   			 */
>   			switch (info->bitlength) {
>   			case 8:
> -				val = (uint64_t)*(uint8_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint8_t*)(data + info->offset);
>   				break;
>   			case 16:
> -				val = (uint64_t)*(uint16_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint16_t*)(data + info->offset);
>   				break;
>   			case 32:
> -				val = (uint64_t)*(uint32_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint32_t*)(data + info->offset);
>   				break;
>   			case 64:
> -				val = (uint64_t)*(uint64_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint64_t*)(data + info->offset);
>   				break;
>   			default:
>   				val = ~0;
> 



Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Aug. 16, 2018, 9:15 a.m. UTC | #2
On 08/15/2018 09:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Fix up some build warnings because of missing const casting
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/crsdump/crsdump.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index abf20ce1..706677c4 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -74,7 +74,7 @@ static void crsdump_show_info(
>  			/*
>  			 *  CRS_BIT*() data
>  			 */
> -			val = (uint64_t)*(uint8_t*)(data + info->offset);
> +			val = (uint64_t)*(const uint8_t *)(data + info->offset);
>  			while (mask && ((mask & 1) == 0)) {
>  				val >>= 1;
>  				mask >>= 1;
> @@ -87,16 +87,16 @@ static void crsdump_show_info(
>  			 */
>  			switch (info->bitlength) {
>  			case 8:
> -				val = (uint64_t)*(uint8_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint8_t*)(data + info->offset);
>  				break;
>  			case 16:
> -				val = (uint64_t)*(uint16_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint16_t*)(data + info->offset);
>  				break;
>  			case 32:
> -				val = (uint64_t)*(uint32_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint32_t*)(data + info->offset);
>  				break;
>  			case 64:
> -				val = (uint64_t)*(uint64_t*)(data + info->offset);
> +				val = (uint64_t)*(const uint64_t*)(data + info->offset);
>  				break;
>  			default:
>  				val = ~0;
Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
index abf20ce1..706677c4 100644
--- a/src/acpi/crsdump/crsdump.c
+++ b/src/acpi/crsdump/crsdump.c
@@ -74,7 +74,7 @@  static void crsdump_show_info(
 			/*
 			 *  CRS_BIT*() data
 			 */
-			val = (uint64_t)*(uint8_t*)(data + info->offset);
+			val = (uint64_t)*(const uint8_t *)(data + info->offset);
 			while (mask && ((mask & 1) == 0)) {
 				val >>= 1;
 				mask >>= 1;
@@ -87,16 +87,16 @@  static void crsdump_show_info(
 			 */
 			switch (info->bitlength) {
 			case 8:
-				val = (uint64_t)*(uint8_t*)(data + info->offset);
+				val = (uint64_t)*(const uint8_t*)(data + info->offset);
 				break;
 			case 16:
-				val = (uint64_t)*(uint16_t*)(data + info->offset);
+				val = (uint64_t)*(const uint16_t*)(data + info->offset);
 				break;
 			case 32:
-				val = (uint64_t)*(uint32_t*)(data + info->offset);
+				val = (uint64_t)*(const uint32_t*)(data + info->offset);
 				break;
 			case 64:
-				val = (uint64_t)*(uint64_t*)(data + info->offset);
+				val = (uint64_t)*(const uint64_t*)(data + info->offset);
 				break;
 			default:
 				val = ~0;