Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp950493imm; Fri, 27 Jul 2018 08:47:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekuc5ziUhgZzvYQDvT6iWM6Qlr3bq7cfBu/WvjvEjAgBJJ731/F2/Sk3q5X3shfakke0Fr X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr6428040pgn.74.1532706420264; Fri, 27 Jul 2018 08:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532706420; cv=none; d=google.com; s=arc-20160816; b=Pg5bHOLfSg7Q3cYpdc/NDGYyUaSnwb7bA0wSs8AbM5mkME2cQtgMT0TZkmA1xiFTgr /WfycH7N4eA7XAqC0e8PGS8Alkimny+imCFPNyu7AO2cSC/y2rkDqLRPZDDA0pNcBWTH SApP6Q6uDWTn3jvMeGu8iC/JBxN3C7+vB2Y3FJyV8d/ueOfzywQh3AP4+gpCXWF00J5w 1yE21/gjay1UbQYJyzJ4Z+bCa+WbQT1F7tLWwJ8/UJ5Dfn1bSjss3LR60bp6muyfMmq2 G6FvVskwlsYqSxuwvWZEv0GMTQiCy+R4vHycU5UT7fts7RjZV5vHvuKxSmJbW94NGuSE lAvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9u/4VSnrMe75sG5CK6eDxPbaGJ0enwitvxCNRflaQbo=; b=C1VGywDtboPrSoWn2juvTgIPFTxfWDbQVzaIyxi6ML04IUWaGjb4Zz8XdbsAMPkeOu FHvm8gQVRXC5kJ678fxwRT7GF3Z/8o/VqWGNQtOgmQCKbYmKrp11xHrkhgVDdQpPaJAX fTyNYVaJU4K+AtGfDjyrqJhk5G1uUuMYnUomGppJ0tCSfRa1/5KudWzkyiP68BP+PKhi EYbOMtgCO8GCxdvG2T00c0bZL/7gkx/eUw7YOZQjYmaiwGpR6UO6/yN+oeeZwfLNmOce aLx0eizYEU9CYzZpPnpsOT69am4KlFUSpp3im7w1SAfoU+Mohq/ypPeeLHFjcrM30zhc XdaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y187-v6si3911784pgd.459.2018.07.27.08.46.45; Fri, 27 Jul 2018 08:47:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388785AbeG0RIR (ORCPT + 99 others); Fri, 27 Jul 2018 13:08:17 -0400 Received: from bran.ispras.ru ([83.149.199.196]:11131 "EHLO smtp.ispras.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732981AbeG0RIR (ORCPT ); Fri, 27 Jul 2018 13:08:17 -0400 Received: from myklebust.intra.ispras.ru (unknown [10.10.2.207]) by smtp.ispras.ru (Postfix) with ESMTP id 2CE39203B2; Fri, 27 Jul 2018 18:45:46 +0300 (MSK) From: Anton Vasilyev To: Arnd Bergmann Cc: Anton Vasilyev , Greg Kroah-Hartman , Arvind Yadav , Jia-Ju Bai , linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] misc: ti-st: Fix memory leak in the error path of probe() Date: Fri, 27 Jul 2018 18:45:36 +0300 Message-Id: <20180727154536.24316-1-vasilyev@ispras.ru> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Free resources instead of direct return of the error code if kim_probe fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev --- drivers/misc/ti-st/st_kim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 5ec3f5a43718..14a5e9da32bd 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -756,14 +756,14 @@ static int kim_probe(struct platform_device *pdev) err = gpio_request(kim_gdata->nshutdown, "kim"); if (unlikely(err)) { pr_err(" gpio %d request failed ", kim_gdata->nshutdown); - return err; + goto err_sysfs_group; } /* Configure nShutdown GPIO as output=0 */ err = gpio_direction_output(kim_gdata->nshutdown, 0); if (unlikely(err)) { pr_err(" unable to configure gpio %d", kim_gdata->nshutdown); - return err; + goto err_sysfs_group; } /* get reference of pdev for request_firmware */ -- 2.18.0