From: Simon Glass Date: Sun, 18 Oct 2015 21:17:20 -0600 Subject: [U-Boot] [PATCH v2 11/28] i8042: Adjust kbd_reset() to collect all failures In-Reply-To: <1445224657-20622-1-git-send-email-sjg@chromium.org> References: <1445224657-20622-1-git-send-email-sjg@chromium.org> Message-ID: <1445224657-20622-12-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Rather than lots of 'return' statements, use goto to a single return. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None drivers/input/i8042.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index dbd4b00..4c887f4 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -485,30 +485,33 @@ static int kbd_reset(void) /* controller self test */ if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK) - return -1; + goto err; /* keyboard reset */ if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) || kbd_read(I8042_DATA_REG) != KBD_ACK || kbd_read(I8042_DATA_REG) != KBD_POR) - return -1; + goto err; /* set AT translation and disable irq */ config = kbd_cmd_read(CMD_RD_CONFIG); if (config == -1) - return -1; + goto err; config |= CONFIG_AT_TRANS; config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN); if (kbd_cmd_write(CMD_WR_CONFIG, config)) - return -1; + goto err; /* enable keyboard */ if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) || !kbd_input_empty()) - return -1; + goto err; return 0; +err: + debug("%s: Keyboard failure\n", __func__); + return -1; } static int kbd_controller_present(void) -- 2.6.0.rc2.230.g3dd15c0