From patchwork Wed Sep 21 15:12:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9343717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F8956077A for ; Wed, 21 Sep 2016 15:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96D312A61D for ; Wed, 21 Sep 2016 15:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B8E92A708; Wed, 21 Sep 2016 15:13:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61FB52A61D for ; Wed, 21 Sep 2016 15:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755849AbcIUPNd (ORCPT ); Wed, 21 Sep 2016 11:13:33 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34362 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755814AbcIUPNc (ORCPT ); Wed, 21 Sep 2016 11:13:32 -0400 Received: by mail-pf0-f193.google.com with SMTP id 21so2521433pfy.1 for ; Wed, 21 Sep 2016 08:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N5fQ3EB5kHzBR5xTUOfBphkm2tCGGrCDkO5czgJlhH8=; b=zYI3wNA6W5s5VIluohDSZW+0z6hjPWWQ8QSQdHjPZLQBgtzRQC+giazKN0F0NcFNZg epiRsMZVjX64QO/6yvo7UsUEOgzdE98NLtc/BQR6u2QpU3PRlDIRlNva4/SvXGkPkztQ IIXHYGWIKXP4mO/wslKXaYBvX6CM9VK5MXyJFoVaP+anhSpcu7YZyBf/ABlYAQdqhaZD iEbRhUnKlD7sxo0VbhuheJ5ag2fDPanlh8zUXYYgYaG7cnwGGF9fumJDCK1etSlAztGQ N5SUw7vO9ix48hlUYJuoJ1VPgQXSGfw+H/rvm8pfpYrdFK0T/etDpffPhUiTGORwwnwV C3XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N5fQ3EB5kHzBR5xTUOfBphkm2tCGGrCDkO5czgJlhH8=; b=ckVmZAQ00qrS4x6pGp9HeQR/06Ls1jlJTP+fiCye/Nzq3soU+HJpC3soV49dwEyikO 7R6ib7wvGSJcgdeNuMdSoODs/FouvsZ7QUaQJJhJSes6UlfaRJGkevwSpUV0/ONBmYGf dvYTqpgWkWw9BKTakj8XDdjHQ1OMuGGSIgzPVpmrWWQOa6r9q6GbN+INSNixARXz7Zlm X0YJA+J9SwmBuplpOvTIBdCkrhXMkpEoIAgnXYgR5r7Tu6JtiTJ20OXqkDtMjfvY704S uZAcpVVVHsLNvVStloIaEqkPQQKywwFgdnwXo06iO8wRuDn5lCixz6FGs7FjbJTTQtFp Mhrw== X-Gm-Message-State: AE9vXwMGUUbdhsOrDjw8Hv+B49HCmlfZaliBurjSDkJVDn9AXtprvAqVx8qEQxeNy4riFA== X-Received: by 10.98.60.68 with SMTP id j65mr65331659pfa.55.1474470732359; Wed, 21 Sep 2016 08:12:12 -0700 (PDT) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id d26sm77865652pfe.37.2016.09.21.08.12.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 08:12:11 -0700 (PDT) From: Wei Yongjun To: Jiri Kosina , Benjamin Tissoires , Henrik Rydberg Cc: Wei Yongjun , linux-input@vger.kernel.org Subject: [PATCH -next] HID: alps: fix error return code in alps_input_configured() Date: Wed, 21 Sep 2016 15:12:05 +0000 Message-Id: <1474470725-4789-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun Reviewed-by: Benjamin Tissoires --- drivers/hid/hid-alps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 2808da9..507372e 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) input2 = input_allocate_device(); if (!input2) { - input_free_device(input2); + ret = -ENOMEM; goto exit; } @@ -426,7 +426,8 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) __set_bit(INPUT_PROP_POINTER, input2->propbit); __set_bit(INPUT_PROP_POINTING_STICK, input2->propbit); - if (input_register_device(data->input2)) { + ret = input_register_device(data->input2); + if (ret) { input_free_device(input2); goto exit; }