Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp188002pxf; Wed, 10 Mar 2021 04:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0xHMT+IMyzPFpegQLrZreMold9Z14l3p4rKcCzKRqSMCe8fA4c/DoAzwjqUb7m8wgDYKZ X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr3290412eju.532.1615377873674; Wed, 10 Mar 2021 04:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615377873; cv=none; d=google.com; s=arc-20160816; b=G4VMXcZlf1JU2X8k2RpcyfVeRgM8BxY25R1Vs/t5GK02VV+TkV40u+anGrV2bizbB0 saWLympCuccaPHbJch/z2PlaNV6ITUFkDxQBW+hADz0QW0V7A/VzZHGIY6m5oepz0vZ4 f+pw2c2OD7fA6qLYNj5eGN0bDdbzpyraAYG9wg29aMIT1WIdAFt2Mz+Bz7ZUIklMwpZ+ y2aqMMP46lcVZpUR/W9fS58KrDCOl+W/ZMbTtsgGuHUkg5RzY/LJX4ROfvmZ6w3pmNjj tsWu/m8ZWkkQs4X8Mxedcg8wWf559Ksk4UGw+ByTWxOgqg9v8ri5RsnhJLu/XYkIIGvc ceNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=dlqVLTWOTrikd1dncf0ixNXcbLRecLbYPdhiTz2QQsg=; b=fE0p/dXCwUQqt+NlcfSTLGhjCAPXOWOXL8DaHuzKfRGrWCgigDw63obssZUEwFzCIF KkQb9We5bQ/N1cu6VnT+dnAIXRJHn7sQ/3zSSciNxvQO9DjoV9p6JWvepM9PyJ8eswzt WqJ9/Q++xgsP54rcINK2IYaulLmSImsyOlsoKics+MYDNjRWveORR6WaWbtpmo2gyITK kqX1VPuPoA8EaoEXQCQ0PQW9BMGvRsQpj3q8AaP5J+eO0Afb+wt3Pj1FgQrjKCEkVF6K Ygo7+ckHX4TVc1evFMy6R1tD9OMCa/aI5yx9I+EQIktgpdsZnFbZGOwMUXE6n4oyRGCD e7IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IlbejYfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du6si4215673ejc.393.2021.03.10.04.04.10; Wed, 10 Mar 2021 04:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=IlbejYfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S232750AbhCJMCs (ORCPT + 99 others); Wed, 10 Mar 2021 07:02:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbhCJMCk (ORCPT ); Wed, 10 Mar 2021 07:02:40 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D19C061760 for ; Wed, 10 Mar 2021 04:02:39 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so7593075wmj.2 for ; Wed, 10 Mar 2021 04:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dlqVLTWOTrikd1dncf0ixNXcbLRecLbYPdhiTz2QQsg=; b=IlbejYfHeXrIsqw5NZNVZk+8IE4RQ4b8f8wSrjm/SSTVYsip2XiKzDeCcFu175GzWM 5no/YG1PM040hYzcBSHClu3O/dhHRKyWdFHli1vNQLZwFDwWeThwiqfMUKQH2dHmYA2T rA591uTi4Uj5souPrH0ka0y1h5e+YjLJ125d8f8mOqBB1G18bA9g24xmdVzJWzaZ9RFl t/6o1aIi/ehzFUJYI1+OL4k7LhgVsjQjpkScP4LJvCDOKn76cQGePll9JIDF7Tl69sys fovELYDyLK6zzX0gxPaED5ocON9r55Dd2WPNKtSFyvBrgcPg2ztbk2xGyj1w+PJnDunk p9yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dlqVLTWOTrikd1dncf0ixNXcbLRecLbYPdhiTz2QQsg=; b=J9VyIAfINE1odDbutu40GkNfK868gm+OLlZutkQ++loxVFzzljY2o1Q5R7yzfSqSKb qDPpywAWqiUfpyTvSptl0VRDISqHe5yzw1VBWNI15x2Us97EwGfFv0yCIaj7kGj0E7Rq 1s6C6mGi953nhiv8eiFDkFBJbNgcQCfE31eVl8ehFUz5olh9UvIISQv40e2Xsz29oFWG VWKSiWRVDHNa+VjoW4T55ium8Qy5Ql1vFqBGnZoEVSGRZZnXhv6mAvYhDjtx7+RfU3qU 8SsnsMIDs3PGhAbd9JsOCRupuOzhC3sQCV6zJzXCKmzcOFvCxr9f79evR1BDjijNadHM Fmig== X-Gm-Message-State: AOAM530/Jen/oI+vtV4aPt6UUGBWIwJuZHhmKt0GGa7dSdlEwI4hQoMb JVBT1B3XAnl5lc6ExvQfy0zBWjcwIWziMQ== X-Received: by 2002:a05:600c:220d:: with SMTP id z13mr3046652wml.1.1615377758337; Wed, 10 Mar 2021 04:02:38 -0800 (PST) Received: from ?IPv6:2a01:e34:ed2f:f020:8018:efa9:4421:9140? ([2a01:e34:ed2f:f020:8018:efa9:4421:9140]) by smtp.googlemail.com with ESMTPSA id y10sm28607210wrl.19.2021.03.10.04.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Mar 2021 04:02:37 -0800 (PST) Subject: Re: [PATCH] thermal: thermal_of: fix error return code of thermal_of_populate_bind_params() To: Jia-Ju Bai , rui.zhang@intel.com, amitk@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210306141106.18695-1-baijiaju1990@gmail.com> From: Daniel Lezcano Message-ID: Date: Wed, 10 Mar 2021 13:02:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210306141106.18695-1-baijiaju1990@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/03/2021 15:11, Jia-Ju Bai wrote: > When kcalloc() fails and __tcbp is NULL, no error return code of > thermal_of_populate_bind_params() is assigned. > To fix this bug, ret is assigned with -ENOMEM in this case. > > Reported-by: TOTE Robot > Signed-off-by: Jia-Ju Bai > --- > drivers/thermal/thermal_of.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c > index 69ef12f852b7..e8c9041482e9 100644 > --- a/drivers/thermal/thermal_of.c > +++ b/drivers/thermal/thermal_of.c > @@ -710,8 +710,10 @@ static int thermal_of_populate_bind_params(struct device_node *np, > } > > __tcbp = kcalloc(count, sizeof(*__tcbp), GFP_KERNEL); > - if (!__tcbp) > + if (!__tcbp) { > + ret = -ENOMEM; > goto end; > + } Thank you for your patch. Seems like the same happens a few lines before: count = of_count_phandle_with_args(np, "cooling-device", "#cooling-cells"); if (!count) { pr_err("Add a cooling_device property with at least one device\n"); goto end; } Mind to send a patch fixing both ? Thanks -- Daniel -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog