Message ID | 20210319202257.890848-1-daniel.lezcano@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1681335jai; Fri, 19 Mar 2021 13:24:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjS/5tMzMBJDhAQwdvdxbaCJFPyxvxrf+57Yz8I7KPqfdvqWCJ4Ez8YofZawN1QXGuGiG3 X-Received: by 2002:aa7:cd16:: with SMTP id b22mr12051043edw.357.1616185459121; Fri, 19 Mar 2021 13:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616185459; cv=none; d=google.com; s=arc-20160816; b=VAKUyeCQMGiVobyRwxNOE+KNJZ2dSPz0zaomxn5Ts/+q3Z0TI/BGD90jN2grdHKz5R HGawyiQ+F+S56YOZaUZdCQbr4jIDmibvnwHQYiYMAgYGhcRzJw5Q6fbWXX8nLmm1zysS gC1dVxEwqIWuHDxq38Cyn0Y5mYDqMdmQqJ+pc1gRTGY0BSVIqeQ0KLbnArs2q4Ka4j3T AMGW9wNtQOaTGRbqZAORtOZ5P+joV0K14aCDTgqHJGiWOhLQHi5ueuBRMVmBtXa1zmVJ 4DK4UGGtqxJrWhGTDVQDXetO149uAbrG9F7uFOxd8dl2+/03SH0p/NSL9Yjx1KLnAuEG Ix1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=44KsTqzi5W4F/LKdf/AcJLY9ExD+NYSEObPt4n6POTs=; b=rOzmwTqrFabP4c61RXuoTsmlRwo2n54Y5r5WyjdzLrmrRSHnnqIwZuAwxlBideKLvN FWK996w0zUbXJxs3n4FEKtPH+eiJIkozmElWnnElWfaiiIZPAhxE84yNFCelPBGMvO6Q SjUIPvfOTwPRRaLxU36DxhiHBWU6/Eqt/7yjsmTio/ok18vofvXR5FYKkNvS/Azu1yWx HMyZWSieWRUiEbml+dqHdKlLe+612qkP2lyoOYrKMn/8w/gPFLzQqlReZoIuVzrTmjgm 0GyqPQGzapYWU5tRqddj2X5JdIb24vL230Sx6Wq3u0x4Q1c6CGcVfmWqMWPOgDgkIIS3 QMdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZPkGxaM; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-pm-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si4549332edd.298.2021.03.19.13.24.18; Fri, 19 Mar 2021 13:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZPkGxaM; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbhCSUXr (ORCPT <rfc822;jun.nie@linaro.org> + 7 others); Fri, 19 Mar 2021 16:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbhCSUXj (ORCPT <rfc822;linux-pm@vger.kernel.org>); Fri, 19 Mar 2021 16:23:39 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 443D0C061760 for <linux-pm@vger.kernel.org>; Fri, 19 Mar 2021 13:23:28 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id x13so10342936wrs.9 for <linux-pm@vger.kernel.org>; Fri, 19 Mar 2021 13:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=44KsTqzi5W4F/LKdf/AcJLY9ExD+NYSEObPt4n6POTs=; b=vZPkGxaMNuCSL6+mP/HGTfTS0T6fQGDBB3BJOWuuMrBfJepf5D9OjvMaNjE78X4TOQ nKVjYLRqtLQOkWU1fNP0n9uZvo0QpfWtWodm+AiNIjXze+AQe3oT5YncUd/i2lL3gk+B g2HhwTguIWXYhbwGsRyK29HIsfSOEy9+hMTJv15gVqDbRaaQuCbnZPcRqDbSuTG18MbO KakSz8FHnqjix72PKlSmcL02EVM9g6If+zyw5FKh+B2xttXVkHQnaLaT2n27NjY8LFr5 SC/EyRs5e28eO1dw1ZRziO4izlrgUyT5jnK6ocQj97qIb5/0o7jvdl/QpO0vl7kHYvyr QlpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=44KsTqzi5W4F/LKdf/AcJLY9ExD+NYSEObPt4n6POTs=; b=FRWqhHepuT4+6EHH0DRfeh3IbHg4wEzmf0aNWCdO8m3AqAzfx6dcO9gKvUbiMALHPY qXZsMOoZodt6ZdREoQENVNj7SFC/lLUHPVSmzESU/jwV2zOIgGUvu5/JlLVX5M7ZNIyG 4whSA9UltbMiBx/ZonyjipZ4cxn32dVP0bII+1wYxY4sEZ68bbAKEkUTrGHri+xIIi2l CMhb9OZMIjasiN9Vcxm5LTszXY+ZkySLk6PNSW8PKjTTYeDffIe3eqfE9b9DlQSwoj5H Qa4zdBVVuzKLgpPamF1ROB7XjIfzGjAFh/gDCLiK8KNsyFwHSnSOALu5lk0ccBmUVDpX myfQ== X-Gm-Message-State: AOAM531EcY/0dMq5Z3AKEWi77xI/ZeELw77UKoZWJ3PLzZUix33GexAU 1niT81kSw+8S/2+XOHPZPsCScQ== X-Received: by 2002:adf:eec9:: with SMTP id a9mr6403333wrp.252.1616185406849; Fri, 19 Mar 2021 13:23:26 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:ddd7:1eb:a66:7a85]) by smtp.gmail.com with ESMTPSA id g11sm9505524wrw.89.2021.03.19.13.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 13:23:26 -0700 (PDT) From: Daniel Lezcano <daniel.lezcano@linaro.org> To: daniel.lezcano@linaro.org Cc: kernel test robot <lkp@intel.com>, Dan Carpenter <dan.carpenter@oracle.com>, Zhang Rui <rui.zhang@intel.com>, Amit Kucheria <amitk@kernel.org>, linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] thermal: core: Fix memory leak in the error path Date: Fri, 19 Mar 2021 21:22:57 +0100 Message-Id: <20210319202257.890848-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317142215.GA2087@kadam> References: <20210317142215.GA2087@kadam> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-pm.vger.kernel.org> X-Mailing-List: linux-pm@vger.kernel.org |
Series |
thermal: core: Fix memory leak in the error path
|
expand
|
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c8d4010940ef..3566fd291399 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1017,6 +1017,7 @@ __thermal_cooling_device_register(struct device_node *np, out_ida_remove: ida_simple_remove(&thermal_cdev_ida, cdev->id); out_kfree_cdev: + kfree(cdev); return ERR_PTR(ret); }
Fix the following error: smatch warnings: drivers/thermal/thermal_core.c:1020 __thermal_cooling_device_register() warn: possible memory leak of 'cdev' by freeing the cdev when exiting the function in the error path. Fixes: 584837618100 ("thermal/drivers/core: Use a char pointer for the cooling device name") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1