Received: by 10.192.165.156 with SMTP id m28csp138311imm; Thu, 12 Apr 2018 18:27:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx48DVxojeF9hzqzG3xqk5GmpPTynfCxWurdJ74zPqtxgH9qH9RVPQrNuzDpDRq9ZrvnqBQEH X-Received: by 10.98.138.205 with SMTP id o74mr9696335pfk.114.1523582825268; Thu, 12 Apr 2018 18:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523582825; cv=none; d=google.com; s=arc-20160816; b=R61th1XkjDRdMNlJTfhdksKCssrYMDrHAevUZn6xyAaH+0JJBgypWdCvfTHLMYErcI tyfXqbBqUzJ+Bd+dGGXKOzHcCpW/XnwLmPrd8FwILJKPb82OVkILyP5GGLd++r1RJFn/ Qb9XMHmL2BW+hW8rPoPiAaqJ8AxYZLojPQzig537DSL/jXxBlBKaxw2UE+A24n48BGP8 oWuhcYUPYHRiVNWP0H1dPUc8KAvpQBDFtaikwXFEOP3cS2LQ8s31uo4Ok8TlOdaXT+5m OB5dRJ/xHBeEazzCnbBHu5BGFoSdEWXxibz9OzX4HPTaAc774k+SfSueitQYdEQeAifQ Trkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:subject:cc:to:user-agent:organization:from:date :message-id:content-transfer-encoding:mime-version:dkim-signature :dkim-filter:arc-authentication-results; bh=j6DrW9aIrfrZorjt4velkN/TzzpFo+Ep7qPmncDCmis=; b=NojbHHhL4FfD/UCWIv4If2yoFQAJG68xv8xlAkUi9WfqBEBS1hNxTVzf6eAxt5JwqB UnItLjf9YYsLJpmhbGWzLs4ziCKkYw6C3zis86/GAe1+078Gi8Ih8qL2D9tyorfk3atO Kt2Mx2G2XbBvT3mY3YrT9lwLPsYrE8XTOp5HVIbC6SbFk85BHWRn0C3Qv3JxPP21M3ek aOhTR0FnMlq2TF8L0kk98Ldiw40ehLK7LQfjWHKPq1YLRK9UQGTYeU7HQJFHXUTKhtvG MAXZeDmaTAKsd0axUN1DTv40ouTlvsl6jCZFYDP5IBmvFF1685ibM8V3vjQw8eSDQUql rzQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IdxWANoo; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si3174959pgr.635.2018.04.12.18.26.50; Thu, 12 Apr 2018 18:27:05 -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=@samsung.com header.s=mail20170921 header.b=IdxWANoo; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753824AbeDMBMH (ORCPT + 99 others); Thu, 12 Apr 2018 21:12:07 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43212 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbeDMBMF (ORCPT ); Thu, 12 Apr 2018 21:12:05 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20180413011202epoutp0416a22d5120a69ff04239b506a4a5a896~k2a_7qyA60693406934epoutp041; Fri, 13 Apr 2018 01:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20180413011202epoutp0416a22d5120a69ff04239b506a4a5a896~k2a_7qyA60693406934epoutp041 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523581922; bh=j6DrW9aIrfrZorjt4velkN/TzzpFo+Ep7qPmncDCmis=; h=Date:From:To:Cc:Subject:In-reply-to:References:From; b=IdxWANooyXfpoVB5ghZc0fe0lvZh0CsxVJ7CPUSofmARO+0HcGEnXfjNkZ3pzdBEf YZXtWF7orVhn/2PxRJ0qa+xBBJdd8V+TnGjx1ce9XqMOQt/A5FPrh4t4zmnRtAdei4 trRnqEHeb4zuJSXRd842CX/vZkgPWFZR1hZmbFP0= Received: from epsmges2p3.samsung.com (unknown [182.195.40.64]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180413011202epcas1p4d15289021f8c093b86e49e9db9c2cb9b~k2a_kiigI0628806288epcas1p4o; Fri, 13 Apr 2018 01:12:02 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.09.04072.6C100DA5; Fri, 13 Apr 2018 10:03:02 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180413010302epcas2p35b2181417682089d7a1046fd3559ac43~k2THXPWeF2249122491epcas2p3T; Fri, 13 Apr 2018 01:03:02 +0000 (GMT) X-AuditID: b6c32a47-0e3ff70000000fe8-08-5ad001c6e0c6 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id B8.C0.03827.5C100DA5; Fri, 13 Apr 2018 10:03:01 +0900 (KST) MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="utf-8" Received: from [10.113.63.77] by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7300J2DMX1YQ30@mmp1.samsung.com>; Fri, 13 Apr 2018 10:03:01 +0900 (KST) Message-id: <5AD001C5.2040406@samsung.com> Date: Fri, 13 Apr 2018 10:03:01 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Arvind Yadav , myungjoo.ham@samsung.com, kyungmin.park@samsung.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH] PM / devfreq: use put_device() instead of kfree() In-reply-to: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7bCmme4xxgtRBq8ahC2u9S5ktjjb9Ibd 4vKuOWwWn3uPMFrcblzB5sDqsXPWXXaPvi2rGD0+b5ILYI5KtclITUxJLVJIzUvOT8nMS7dV 8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBWqmkUJaYUwoUCkgsLlbSt7Mpyi8tSVXI yC8usVWKNjQ00jM0MNczMjLSMzGOtTIyBSpJSM1ommVbMJ27Ys/MdWwNjE2cXYwcHBICJhJP WxW7GLk4hAR2MEr8WbuDCcL5zihx6+AHti5GTrCi7vUrWCASuxklFrw5wQiS4BUQlPgx+R4L yCRmAXmJI5eyQcLMApoSL75Mgqq/yyhxfMl/sBpeAS2JJ4utQGpYBFQlzpxpYwax2YDC+1/c ANvFL6AocfXHY7DxogIREjvnf2MHaRURSJZom6UJMd5KYtejPrASYQE3iR93e8FaOQWSJH68 a2YEWSshsIZNYvWrRnaI+10krqxdBvWLsMSr41ug4tISz1ZthGpoZ5Ro3zuPGcKZwihx7vo9 JogqY4lnC7uYIFbzSXQc/ssOCTpeiY42IYgSD4ln8+4wQ9iOEg1rF7JDPL+ZUWLqtscsExjl ZiGF1yxEeM1CCq8FjMyrGMVSC4pz01OLjQqM9YoTc4tL89L1kvNzNzGCk5iW+w7Gbed8DjEK cDAq8fAqVJ6PEmJNLCuuzD3EKMHBrCTCO/0xUIg3JbGyKrUoP76oNCe1+BCjKTC8JzJLiSbn AxNsXkm8oYmlgYmZmZG5mQUweYnzNvieiRISSE8sSc1OTS1ILYLpY+LglGpgXJTOX/ppa9ee 1k7VFyVWFyJfPJI59e5i+uOQd21bK3vueEWtOGjgFDqB9wLfNP7vn7rqg9K1os6nPDH+NvPx Q659/C2husvsn7Aryjl+OMZUrab6LGK99v5PleWaW90yZ/yq9DofuzByyzLR69Kf4vPVVtVa zpq/89eXjsXFH+OPsc0UY28KVGIpzkg01GIuKk4EAMB/Y6Z4AwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t9jAd2jjBeiDCa/tbC41ruQ2eJs0xt2 i8u75rBZfO49wmhxu3EFmwOrx85Zd9k9+rasYvT4vEkugDmKyyYlNSezLLVI3y6BK6Nplm3B dO6KPTPXsTUwNnF2MXJySAiYSHSvX8HSxcjFISSwk1GibctBVpAEr4CgxI/J94ASHBzMAvIS Ry5lQ5jqElOm5IJUCAncByrfJwUS5hXQkniy2AokzCKgKnHmTBsziM0GFN7/4gYbiM0voChx 9cdjRpByUYEIie4TlSBhEYFkiSnbu9lBbGYBK4ldj/oYQWxhATeJH3d72SAO28oosenkRWaQ Xk6BJIlrU3QmMArMQnLmLIQzZyGcuYCReRWjZGpBcW56brFRgVFearlecWJucWleul5yfu4m RmDYbjus1b+D8fGS+EOMAhyMSjy8CpXno4RYE8uKK3MPMUpwMCuJ8E5/DBTiTUmsrEotyo8v Ks1JLT7EKM3BoiTOy59/LFJIID2xJDU7NbUgtQgmy8TBKdXA6BTTc+7NbFU+Htu3djdzo6q7 yl1jHx00SZqcUGLQa9rjc/zTAk1rpaTmTQcf7ZixyFDqfNnl2hkzFvTMrkibXXFQTWzDxNlh klf2F93zjnu/4mFosvkdkTUWT913RMde/HueawmnTai3lYzDjbY8n5VXRb65H32fFuqyQ1Lt /JLqjDKOI7v+KbEUZyQaajEXFScCAEg5r5dXAgAA X-CMS-MailID: 20180413010302epcas2p35b2181417682089d7a1046fd3559ac43 X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180330114418epcas5p1affd1c3d97e7422dd33e6d3ca73073be X-RootMTR: 20180330114418epcas5p1affd1c3d97e7422dd33e6d3ca73073be References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm sorry for the late reply. On 2018년 03월 30일 20:44, Arvind Yadav wrote: > Never directly free @dev after calling device_register() or > device_unregister(), even if device_register() returned an error. > Always use put_device() to give up the reference initialized. > > Signed-off-by: Arvind Yadav > --- > drivers/devfreq/devfreq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index fe2af6a..a225b94 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -625,7 +625,8 @@ struct devfreq *devfreq_add_device(struct device *dev, > err = device_register(&devfreq->dev); > if (err) { > mutex_unlock(&devfreq->lock); > - goto err_dev; > + put_device(&devfreq->dev); > + goto err_out; why do you change the goto postion? err_out is correct to free the memory of devfreq instance. > } > > devfreq->trans_table = devm_kzalloc(&devfreq->dev, > @@ -671,6 +672,7 @@ struct devfreq *devfreq_add_device(struct device *dev, > mutex_unlock(&devfreq_list_lock); > > device_unregister(&devfreq->dev); > + devfreq = NULL; It is wrong. If you initialize the devfreq as NULL, never free the 'devfreq' instance. > err_dev: > if (devfreq) > kfree(devfreq); > -- Best Regards, Chanwoo Choi Samsung Electronics