From patchwork Tue Mar 3 17:42:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 230032 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 7038FC3F2C6 for ; Tue, 3 Mar 2020 17:50:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B58D2146E for ; Tue, 3 Mar 2020 17:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257811; bh=p7OhjitPqPkZxr0MXCzNjNv1tyl0e5vLJ5xugonGZCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=r+ww3IzVmpBeBOG1VDjRybGFNi2J5JxwKPmHc9H528V8L1pIEhJABWgywDNezD7uc HiYokEikuAx3lyVX9yaoup35lbBuHAUPURBN+cyMAxd3olZ2fkGjT9zeUuJqUQ7p+O OSA40I8jAM+MTE5rgs5n0jykXgo2jFkzOcoZsxTA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731859AbgCCRuK (ORCPT ); Tue, 3 Mar 2020 12:50:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:57664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731061AbgCCRuH (ORCPT ); Tue, 3 Mar 2020 12:50:07 -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 792942146E; Tue, 3 Mar 2020 17:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257806; bh=p7OhjitPqPkZxr0MXCzNjNv1tyl0e5vLJ5xugonGZCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmEHGZ+z8OezK/NorgB2hHd0VbXiNzY0Wg6g6X59xI/LWbjiGv1UMwmIUtgQRJiya PY5PIfJntx4h9XfcEPPYlvJthiU/lGcWOiCyeZ7yoaHhtzYmoAz8paNNj5uOO49NiY W3iuiDOdtzRxusoV5rk+KuxAikdgBlDvuQBTgeeg= 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.5 107/176] HID: alps: Fix an error handling path in alps_input_configured() Date: Tue, 3 Mar 2020 18:42:51 +0100 Message-Id: <20200303174317.217651653@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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; }