Message ID | 20180815131129.24146-17-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | [01/27] lib: fwts_framework: ensure src pointer is const | expand |
On 2018-08-15 06:11 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Add in missing const, cleans up warnings such as: > cast discards ‘const’ qualifier from pointer target type > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/sbbr/fadt/fadt.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/src/sbbr/fadt/fadt.c b/src/sbbr/fadt/fadt.c > index 430e39da..f7e16d9a 100644 > --- a/src/sbbr/fadt/fadt.c > +++ b/src/sbbr/fadt/fadt.c > @@ -264,64 +264,64 @@ static int fadt_sbbr_reduced_hw_test2(fwts_framework *fw) > fwts_log_warning(fw, "CENTURY is non-zero: 0x%x", > fadt->century); > } > - if (memcmp((void *)&fadt->x_pm1a_evt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1a_evt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1A_EVT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1b_evt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1b_evt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1B_EVT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1a_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1a_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1A_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1b_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1b_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1B_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm2_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm2_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM2_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm_tmr_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm_tmr_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM_TMR_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_gpe0_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_gpe0_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_GPE0_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_gpe1_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_gpe1_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > Acked-by: Alex Hung <alex.hung@canonical.com>
On 08/15/2018 09:11 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Add in missing const, cleans up warnings such as: > cast discards ‘const’ qualifier from pointer target type > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/sbbr/fadt/fadt.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/src/sbbr/fadt/fadt.c b/src/sbbr/fadt/fadt.c > index 430e39da..f7e16d9a 100644 > --- a/src/sbbr/fadt/fadt.c > +++ b/src/sbbr/fadt/fadt.c > @@ -264,64 +264,64 @@ static int fadt_sbbr_reduced_hw_test2(fwts_framework *fw) > fwts_log_warning(fw, "CENTURY is non-zero: 0x%x", > fadt->century); > } > - if (memcmp((void *)&fadt->x_pm1a_evt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1a_evt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1A_EVT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1b_evt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1b_evt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1B_EVT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1a_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1a_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1A_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm1b_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm1b_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM1B_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm2_cnt_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm2_cnt_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM2_CNT_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_pm_tmr_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_pm_tmr_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_PM_TMR_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_gpe0_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_gpe0_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, > "X_GPE0_BLK is a non-zero general " > "address structure."); > } > - if (memcmp((void *)&fadt->x_gpe1_blk, > - (void *)&null_gas, > + if (memcmp((const void *)&fadt->x_gpe1_blk, > + (const void *)&null_gas, > sizeof(fwts_acpi_gas))) { > passed = false; > fwts_log_warning(fw, Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/sbbr/fadt/fadt.c b/src/sbbr/fadt/fadt.c index 430e39da..f7e16d9a 100644 --- a/src/sbbr/fadt/fadt.c +++ b/src/sbbr/fadt/fadt.c @@ -264,64 +264,64 @@ static int fadt_sbbr_reduced_hw_test2(fwts_framework *fw) fwts_log_warning(fw, "CENTURY is non-zero: 0x%x", fadt->century); } - if (memcmp((void *)&fadt->x_pm1a_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1A_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1B_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1a_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1A_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1B_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm2_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm2_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM2_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm_tmr_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm_tmr_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM_TMR_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe0_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe0_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_GPE0_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe1_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe1_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw,