From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 22836C4332B for ; Wed, 10 Mar 2021 12:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D63F364FFB for ; Wed, 10 Mar 2021 12:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232759AbhCJMCt (ORCPT ); Wed, 10 Mar 2021 07:02:49 -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-Google-Smtp-Source: ABdhPJzyl0mOxjO8QTMhpDMKlfhOPmDe6unEELImhzPQxinkABg6DsE/szmYglilSx0lHPd30rN2pw== 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