Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4220462imm; Mon, 20 Aug 2018 11:54:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzfKMbVd3fSryk24QBg7RP2IaTeVzeZgGLN/cY2QTGw+Ug6A4ydu7CctjM1rg66mkZHBgA1 X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr26956598pfo.151.1534791295128; Mon, 20 Aug 2018 11:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534791295; cv=none; d=google.com; s=arc-20160816; b=uFm7dVzUrzrGP2R+6pbvTrFvKnKeF/MSxeFG7wS/WH6IOktqy85x0iPQsZPc+LhIi3 T75cabFm7XrEj++o0X1n5Wg7eLjOzNXji+5/lxvyDZ5hp7LRoDd+J/9MRS8mwmSUaLCl s+LBgLhvdwhnNoVLXMvKMUNmgrHryoP9oCPtliFPgrveEg7a+CcRYHLE4hJSqAiAPLnk 2iFDEvue/SSIMXkk+v+sYcbnMwJli2VhHsPhBsY0WGbY1SP6aD/lv2FulORx+J+3xdcY Ec7CHH8pnxbPAXzP90V8vSGSzn7EdPzbzlZNXNjp84US2mYMkRQ/Qu/wwVAre3YtU5KP RbxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=yjHFWSUiSb/uLFo2wsc8ENflHwLBaM9ufjNdEItan/o=; b=YP+kjUHQMBxjSilFhm73bRaDSzaemYHAmuDV6QFFC0uMCHwlQY3660g6YAl3u3XObs 8VSvpevHkbPv++C85nksyMN4RPFCDfxGBK0eVw5xcn2Z2RAEt+M5/TPuyMgrC8TAtTRj Gx66o2T4JPVyViVevDMF7PB/xVDo8FkudNEUHW1q6tgoXqSWCg3eN8eVsHbd4pcfzDA3 qikv4PfVY7JRvOv2/u4hcEEvRNlBnXxL5PDxA321aaFievxi1/v855HWQoXuADmJgj7F TJmonFvjoPocoQIJBFGgWTX5kjXVvVqFBTP+OR/qzt2v89vWi1vyz9J3uSuoxlILzR6g asZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QwvF6JbI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12-v6si10032639pli.248.2018.08.20.11.54.40; Mon, 20 Aug 2018 11:54:55 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QwvF6JbI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726848AbeHTWJ0 (ORCPT + 99 others); Mon, 20 Aug 2018 18:09:26 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:36006 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbeHTWJ0 (ORCPT ); Mon, 20 Aug 2018 18:09:26 -0400 Received: by mail-oi0-f66.google.com with SMTP id n21-v6so27677274oig.3; Mon, 20 Aug 2018 11:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yjHFWSUiSb/uLFo2wsc8ENflHwLBaM9ufjNdEItan/o=; b=QwvF6JbIoyzllD/5RlevDzv3LJoYjili8aqJ5wT1CQbqy+K2INFlnukRh29j8jHUlc dltGtpg7rfkVuqc+v06ziEJ7odBNau7Nv23eG+f0g/WAn+DKY2si3aeLxFzd+mD/+TVI EQNBQFv0g+kgsux8IRHWQD44AD9eThCi+RRBoUjDKlfYIq3wE3Kq4A4qUYVx5qTTU6s0 lR9ZGgmqlpZbRfTbpIwJ4Y4nIiXpm0EftenJ8U3oYC6aYIxtX9f/5VoSUKViYxHESePy 4kkZB2YzqYyy9Ui40BF6Xepx8IQElWzCizx7FWsy88aVLC5RuthWxhM1Nft+ossTUcIH nRHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yjHFWSUiSb/uLFo2wsc8ENflHwLBaM9ufjNdEItan/o=; b=lWp+7akJeMw7Eolti5w+I07tCQbCcdvnNpvvjEu0x/Ruy6RioJe7AfDfJ9jR6GTBSN VNyNuKaZYkhWdke9VhTkX2BOCPc6BAolo1HSJ6bgS7dOqnOqRYPXQItbeGXwX5PB/NBd pmzuTVrECb7r1of+YWes7jqM/QbrXN1E15cQsltEmPqxswt/MwuReTN+s1b53fiPAHLo H8lvh6t7j4XkQMsjtl4X2NvBtreeqjfTQo9sXCLGshELvIXunMj5/wgx2nhMqR++wxyC xrY6HPECvq4oixPd4SzA25mOLGvz+hZ3AjP5bd03Jz/xkUMgdsEXStonvd2wm92WNyAn 94wQ== X-Gm-Message-State: AOUpUlGPWzauQXIfReZ3qugyOnT9/L25d7tLVziIONyRqqsh5a6pq9n/ 6+UK86Q6H6fwekt0cGvuKWA= X-Received: by 2002:aca:e6cd:: with SMTP id d196-v6mr14302127oih.94.1534791158159; Mon, 20 Aug 2018 11:52:38 -0700 (PDT) Received: from localhost.localdomain ([12.251.228.178]) by smtp.gmail.com with ESMTPSA id o206-v6sm8501808oif.7.2018.08.20.11.52.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 11:52:37 -0700 (PDT) Date: Mon, 20 Aug 2018 11:52:34 -0700 From: Eduardo Valentin To: Colin King Cc: Zhang Rui , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] thermal: armada: fix incorrect check for drvdata allocation failure Message-ID: <20180820185232.GA16026@localhost.localdomain> References: <20180730122716.6267-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730122716.6267-1-colin.king@canonical.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hello Colin, On Mon, Jul 30, 2018 at 01:27:16PM +0100, Colin King wrote: > From: Colin Ian King > > Currently the drvdata allocation failure is being incorrectly checked by > checking priv and not drvdata. Fix this and also free priv to fix a > memory leak. > > Detected by Coverity Scan, CID#1472102 ("Logically dead code") > > Fixes: c9899c183921 ("thermal: armada: use the resource managed registration helper alternative") > Signed-off-by: Colin Ian King > --- > drivers/thermal/armada_thermal.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c > index 4164a5a4e480..b164fd9f21ac 100644 > --- a/drivers/thermal/armada_thermal.c > +++ b/drivers/thermal/armada_thermal.c > @@ -611,8 +611,10 @@ static int armada_thermal_probe(struct platform_device *pdev) > return -ENOMEM; > > drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); > - if (!priv) > + if (!drvdata) { Thanks for the fix but, I already collected this patch: 84b64de597bc ("thermal: armada: fix copy-paste error in armada_thermal_probe()") which fixes the same issue you are addressing here. > + devm_kfree(&pdev->dev, priv); As already mentioned by Daniel, the above is not necessary, as it is a devm_* helper. BR, > return -ENOMEM; > + } > > priv->dev = &pdev->dev; > priv->data = (struct armada_thermal_data *)match->data; > -- > 2.17.1 >