From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70DA0C3F2D1 for ; Tue, 3 Mar 2020 17:57:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3EEEF206D5 for ; Tue, 3 Mar 2020 17:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258255; bh=p7OhjitPqPkZxr0MXCzNjNv1tyl0e5vLJ5xugonGZCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=twlKkgfWwFd7wFdYqYcmGF1a9T30EBR5IeYGZn0fd9Sd/A9qeqqhC1/LVFtpLVkJt N2OmGIppJUsiKvF10fXZmlQnwpMbB4X0X60evpD77DBuG+zd7PW5DpC0IUjMCmIkLF N5PB/j/6KXZ+Szh7isJ73p+q3OfhqUPy/AZXK5QE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733101AbgCCR5e (ORCPT ); Tue, 3 Mar 2020 12:57:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:40102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732772AbgCCR5b (ORCPT ); Tue, 3 Mar 2020 12:57:31 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F0EAC206D5; Tue, 3 Mar 2020 17:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258251; bh=p7OhjitPqPkZxr0MXCzNjNv1tyl0e5vLJ5xugonGZCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOF+FserQLXMOM76j9UQg9IA/GkP3BOu0ibnRAmMJK6PXOnjKJaeBF9t2/Z4DzeB8 R1mTPosg3Q9ncujm5pb+8pNl6fTrV/kNyY+HasnrT729H0wu0O38Ra6byU735nmqwr 7vftFvXjLEMpu5L/k8EbWfCzEIovRozrlfgGD3tM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jiri Kosina Subject: [PATCH 5.4 092/152] HID: alps: Fix an error handling path in alps_input_configured() Date: Tue, 3 Mar 2020 18:43:10 +0100 Message-Id: <20200303174313.039780753@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174302.523080016@linuxfoundation.org> References: <20200303174302.523080016@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET commit 8d2e77b39b8fecb794e19cd006a12f90b14dd077 upstream. They are issues: - if 'input_allocate_device()' fails and return NULL, there is no need to free anything and 'input_free_device()' call is a no-op. It can be axed. - 'ret' is known to be 0 at this point, so we must set it to a meaningful value before returning Fixes: 2562756dde55 ("HID: add Alps I2C HID Touchpad-Stick support") Signed-off-by: Christophe JAILLET Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-alps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -730,7 +730,7 @@ static int alps_input_configured(struct if (data->has_sp) { input2 = input_allocate_device(); if (!input2) { - input_free_device(input2); + ret = -ENOMEM; goto exit; }