[PATCH 15/46] bios: hdaaudio: reduce scope of variables
Keng-Yu Lin
keng-yu.lin at canonical.com
Tue Jan 20 06:52:37 UTC 2015
On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> cppcheck is picking up some minor style issues which can
> be easily fixed:
>
> [src/bios/hdaaudio/hdaaudio.c:34]:
> (style) The scope of the variable 'pin_setting' can be reduced.
> [src/bios/hdaaudio/hdaaudio.c:63]:
> (style) The scope of the variable 'item' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/bios/hdaaudio/hdaaudio.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/bios/hdaaudio/hdaaudio.c b/src/bios/hdaaudio/hdaaudio.c
> index 6b6d963..697ad01 100644
> --- a/src/bios/hdaaudio/hdaaudio.c
> +++ b/src/bios/hdaaudio/hdaaudio.c
> @@ -31,7 +31,6 @@ static int hda_audio_read_pins(const char *path, const char *file, fwts_list *se
> FILE *fp;
> uint16_t pin;
> uint32_t setting;
> - hda_audio_pin_setting *pin_setting;
> char name[PATH_MAX];
>
> fwts_list_init(settings);
> @@ -42,7 +41,9 @@ static int hda_audio_read_pins(const char *path, const char *file, fwts_list *se
> return FWTS_ERROR;
>
> while (fscanf(fp, "0x%hx 0x%x\n", &pin, &setting) == 2) {
> - pin_setting = calloc(1, sizeof(hda_audio_pin_setting));
> + hda_audio_pin_setting *pin_setting;
> +
> + pin_setting = calloc(1, sizeof(hda_audio_pin_setting));
> if (pin_setting == NULL) {
> fwts_list_free_items(settings, free);
> fclose(fp);
> @@ -60,9 +61,9 @@ static int hda_audio_read_pins(const char *path, const char *file, fwts_list *se
> static void hda_audio_dump_pins(fwts_framework *fw, const char *config,
> fwts_list *settings)
> {
> - fwts_list_link *item;
> -
> if (fwts_list_len(settings) > 0) {
> + fwts_list_link *item;
> +
> fwts_log_info(fw, "%s:", config);
>
> fwts_log_info_verbatum(fw, " Pin Setting");
> --
> 2.1.4
>
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list