Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp192902pxf; Wed, 10 Mar 2021 04:11:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEzeMYqjB3LSSLkAkTokockmddzmroxpjGSHJ23A2g9cJqnAhysG9zWpawOEZ3gLiSKHZJ X-Received: by 2002:aa7:d0d7:: with SMTP id u23mr2806267edo.255.1615378299011; Wed, 10 Mar 2021 04:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615378299; cv=none; d=google.com; s=arc-20160816; b=kX7r33zV2dxm3Vyx3w4t2gw2x/pe0ogQGcHbqI7AKl78Zs5oBOqURlBXBDb2cm1CpQ /s5JGZ3c08sKREBR18L914P+NUrJbjLveyccCY7+wJ4Wd9jJdhqffI55jEn3B/REebHV rSSBLV68MpN4QNH4/y958VmEJEt+YikTGBXr6TGBERb0W/Pz/RnRFHYGURHrsOZ3XUsz UFcshyPmteHeGfDza1PICkXq6KGTUvyDX4+1rqb1ulrw7hw3TviFRPL4w0E5xAiCvYon wIk8EfVE7EgTAOKyw20wjitx98mw27Va66lbgmckmQ7URvi4vBi7zOv8gaDp5K4oZOlY uTSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=EGYkQJ9FJJaI5eGPOqdWnbYRXcHETF+ClVAnsVwF5+w=; b=MJmoz1xOucFMpqbqvh8oHaWPHuV+dGTdArwpmnI9pbsujUL1szlu/rk39SheTCn5Oh 5oNlgGZ9VaKcStpFjTyWcHYW0ASASqPiUpCpV3FJoMXWsgg94EQDt6LleJynoxBiwUG4 u1vz49EaAQTlDdS/bnIpUxeCMpVhKgiGRCjsTpojpm/wN/67j+tpMGe4RKz247Yj4sjZ WMRqK2urXbEKRnjWQiEzOcRNy9vhSr5RWc7/qhtVT8ICCx+KvyjHijWJNzREJx2bKRVW v49SAFXM1Pqte2+uSkOJXi4PZkNUYGRc7W9Bmq+4US1IPIrDLZj7Fss03LKwmjlWHj6m qxyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kjttHZDs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a22si11545058ejp.696.2021.03.10.04.11.05; Wed, 10 Mar 2021 04:11:39 -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=@gmail.com header.s=20161025 header.b=kjttHZDs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbhCJMJm (ORCPT + 99 others); Wed, 10 Mar 2021 07:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232073AbhCJMJb (ORCPT ); Wed, 10 Mar 2021 07:09:31 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576A0C061760; Wed, 10 Mar 2021 04:09:31 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id w34so10219109pga.8; Wed, 10 Mar 2021 04:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=EGYkQJ9FJJaI5eGPOqdWnbYRXcHETF+ClVAnsVwF5+w=; b=kjttHZDsCbGL7E392wZMMsNEOP1cKrFYs0OCWryWfTJ20IGobyoI3PMtH9vo+fAhHU /QdLtw/XBR/ZJneft7H++HVEpno1/mbTC816sb1yXPBUR6R44s15A3UUUQ6/2IiNCKBW MQepIDYPV4dNhPh1QkHcf4k3kM4ZptiJ0GO9wtPgRy2ru18abRFvGKZ8sn7q+l/BMO4X qkcjvKqauC/dS9ahsyNPCpCZQzh/hukoOurD60FfN23nnLS2gQsUrb8FcSpFYrceZOQU euS8LMSUOCxkxyunYEWRu58DNGKuKCWw/ztSIgLp/+WHBbvsw5YreXA3na1mc5Dahk9O ZtqQ== 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-transfer-encoding :content-language; bh=EGYkQJ9FJJaI5eGPOqdWnbYRXcHETF+ClVAnsVwF5+w=; b=a+1tvYAIftmM7yXXW0ML2o2eHrSvna8U6f8JgEAjvUNEufOujl3HvNOXVFqteQlScc SfA1tlP5qOSuPzU4H16jOMroEbCN38n7k8nqIJPtRHuoB9O68YOAF4MSS6mtAVqVWjCk tm/HTHJY+OdfvO0vzNSeLMLSAL26c0yfZ8S0cFMjd0XVFVkhN39MGdL/DZM6l6u/ZHk+ ndOerAKCNbZNKsRyF1Dpb0rIu1wtqIbv7GaGpb52PgYyFGldeTPi/qHsPT56U2igpOvZ 3oQ5fU2W0AiuvhXww9YKC36ecpL6CKL6iHKw21t/nveeVvnELVziCeKthk3Lev/ReONz Ul2A== X-Gm-Message-State: AOAM531K1x4IMfhOxwbEAk/pxiknVfk4u45HMOipGW+uJl6+WX0GSqe0 OMfE5xszdFAikzzP1t7dhOd0whOJy7ZN9Q== X-Received: by 2002:aa7:9797:0:b029:1f8:1a14:b055 with SMTP id o23-20020aa797970000b02901f81a14b055mr2774190pfp.57.1615378170592; Wed, 10 Mar 2021 04:09:30 -0800 (PST) Received: from [10.38.0.10] ([45.135.186.59]) by smtp.gmail.com with ESMTPSA id a15sm6442537pju.34.2021.03.10.04.09.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Mar 2021 04:09:30 -0800 (PST) Subject: Re: [PATCH] thermal: thermal_of: fix error return code of thermal_of_populate_bind_params() To: Daniel Lezcano , 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: Jia-Ju Bai Message-ID: Date: Wed, 10 Mar 2021 20:09:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/10 20:02, Daniel Lezcano wrote: > 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 for the reply and advice. I will send a new version of the patch to fix them both. Best wishes, Jia-Ju Bai