Patchwork [1/2] lib: fwts_cmos: fix build error with non-Intel architectures

login
register
mail settings
Submitter Colin King
Date Dec. 7, 2012, 9:05 a.m.
Message ID <1354871151-11593-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/204432/
State Accepted
Headers show

Comments

Colin King - Dec. 7, 2012, 9:05 a.m.
From: Colin Ian King <colin.king@canonical.com>

The dummy no-op CMOS fwts_cmos_read() for non-Intel builds
is causing build failures because of the -Wextra flag:

fwts_cmos.c: In function 'fwts_cmos_read':
fwts_cmos.c:53:34: error: unused parameter 'offset' [-Werror=unused-parameter]
fwts_cmos.c:53:51: error: unused parameter 'value' [-Werror=unused-parameter]

This fixes this and makes the no-op function return a known garbage
value.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_cmos.c | 4 ++++
 1 file changed, 4 insertions(+)
Keng-Yu Lin - Dec. 10, 2012, 7:10 a.m.
On Fri, Dec 7, 2012 at 5:05 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The dummy no-op CMOS fwts_cmos_read() for non-Intel builds
> is causing build failures because of the -Wextra flag:
>
> fwts_cmos.c: In function 'fwts_cmos_read':
> fwts_cmos.c:53:34: error: unused parameter 'offset' [-Werror=unused-parameter]
> fwts_cmos.c:53:51: error: unused parameter 'value' [-Werror=unused-parameter]
>
> This fixes this and makes the no-op function return a known garbage
> value.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_cmos.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
> index 583bbb4..7b0ca40 100644
> --- a/src/lib/src/fwts_cmos.c
> +++ b/src/lib/src/fwts_cmos.c
> @@ -52,6 +52,10 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  #else
>  int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  {
> +       FWTS_UNUSED(offset);
> +
> +       *value = ~0;    /* Fake a failed read */
> +
>         return FWTS_ERROR;
>  }
>  #endif
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - Dec. 13, 2012, 9:57 a.m.
On 12/07/2012 05:05 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The dummy no-op CMOS fwts_cmos_read() for non-Intel builds
> is causing build failures because of the -Wextra flag:
>
> fwts_cmos.c: In function 'fwts_cmos_read':
> fwts_cmos.c:53:34: error: unused parameter 'offset' [-Werror=unused-parameter]
> fwts_cmos.c:53:51: error: unused parameter 'value' [-Werror=unused-parameter]
>
> This fixes this and makes the no-op function return a known garbage
> value.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_cmos.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
> index 583bbb4..7b0ca40 100644
> --- a/src/lib/src/fwts_cmos.c
> +++ b/src/lib/src/fwts_cmos.c
> @@ -52,6 +52,10 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>   #else
>   int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>   {
> +	FWTS_UNUSED(offset);
> +
> +	*value = ~0;	/* Fake a failed read */
> +
>   	return FWTS_ERROR;
>   }
>   #endif
>
Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
index 583bbb4..7b0ca40 100644
--- a/src/lib/src/fwts_cmos.c
+++ b/src/lib/src/fwts_cmos.c
@@ -52,6 +52,10 @@  int fwts_cmos_read(const uint8_t offset, uint8_t *value)
 #else
 int fwts_cmos_read(const uint8_t offset, uint8_t *value)
 {
+	FWTS_UNUSED(offset);
+
+	*value = ~0;	/* Fake a failed read */
+
 	return FWTS_ERROR;
 }
 #endif