From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754879AbbILRon (ORCPT ); Sat, 12 Sep 2015 13:44:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59745 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752735AbbILRom (ORCPT ); Sat, 12 Sep 2015 13:44:42 -0400 From: Timur Tabi To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] [v3] hvc_dcc: don't ignore errors during initialization Date: Sat, 12 Sep 2015 12:44:38 -0500 Message-Id: <1442079879-16602-1-git-send-email-timur@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hvc_instantiate() and hvc_alloc() return errors if they fail, so don't ignore them. Signed-off-by: Timur Tabi --- drivers/tty/hvc/hvc_dcc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index 809920d..82f240f 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -70,20 +70,27 @@ static const struct hv_ops hvc_dcc_get_put_ops = { static int __init hvc_dcc_console_init(void) { + int ret; + if (!hvc_dcc_check()) return -ENODEV; - hvc_instantiate(0, 0, &hvc_dcc_get_put_ops); - return 0; + /* Returns -1 if error */ + ret = hvc_instantiate(0, 0, &hvc_dcc_get_put_ops); + + return ret < 0 ? -ENODEV : 0; } console_initcall(hvc_dcc_console_init); static int __init hvc_dcc_init(void) { + struct hvc_struct *p; + if (!hvc_dcc_check()) return -ENODEV; - hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128); - return 0; + p = hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128); + + return PTR_ERR_OR_ZERO(p); } device_initcall(hvc_dcc_init); -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.