Received: by 10.192.165.156 with SMTP id m28csp138928imm; Thu, 12 Apr 2018 18:28:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++M1VeXjGxoYZgdxc0ZvwkxbiNOQg0CQ3kwPXi505kSMBkNeJ4W2GXGQwnTSR1AeEK4yoh X-Received: by 2002:a17:902:584:: with SMTP id f4-v6mr2294743plf.290.1523582893672; Thu, 12 Apr 2018 18:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523582893; cv=none; d=google.com; s=arc-20160816; b=WbmCynsWIG/2RJAWJSEJ/o7ze1uGCTjE2A7pqKntom0JPnUvw86LoKP+yISU5VwNyZ Y7v8fiOd0OUYoH+fVN71cOAdz+cfSQrnGVtu/imXSiHPWCnOEYEv/eNP2kqf7bFEPDTW swN7Nh78RevfioiScXZUSiv/W+k8oNbntGMeT3vjn9gJZv527KsKMj2yq18NJAYwKR6P hGJPw3Up05hDUaYgHVdqiFiJhd4J96u7xr00OXGxnGoh+/lO5ZMimv3JaBCCwNGzCiBK Lz5A4d3pI3kX0QBJ5FKhLEyRq94L0QhT6Md5IcMx49J9ct3x718mptaolF7iXigqEBUg 4cGQ== 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=BR0O7iFL+asbzkBrte6Gz/NUA01t8sh8MPb2wWzRWkA=; b=0IQm548jKgASrwadOKWqmXaOBwNWOKvZFdJ8MLTh9E0tlnSNQF+gqGnDWtrD95ekkD GYcv+aWc2odqZouat7sVH8bVB6hrGh0BNvmF0WY/KgzX/KTpb9kP1uXigi2sGGPqBSeH C0YtrVdTFWRilfiynOi+p3xhCX69wFj9lDOMKhvWdWgpIFW6Lj1tGqtxoanjdg9x83Bp DRAPfHc1/ImBWJ7hCusWqYKbJiHfy8JGJ7E524PLdLuzi6EwBHyu1pDMrd793xX7crUL 8wm1S5K914h+Si5VHpz3zw8tKWyFSYi7ZdS1nYdxt7es41SgV6POe3kEvXayTVWVdNhd CH8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qNJ02cvk; 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 d23si3169523pgn.235.2018.04.12.18.27.59; Thu, 12 Apr 2018 18:28:13 -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=qNJ02cvk; 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 S1753900AbeDMBNG (ORCPT + 99 others); Thu, 12 Apr 2018 21:13:06 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:58046 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbeDMBNE (ORCPT ); Thu, 12 Apr 2018 21:13:04 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180413011302epoutp03c8da9f6ccead028e5313d894d63b9575~k2b240cDa0774707747epoutp03W; Fri, 13 Apr 2018 01:13:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180413011302epoutp03c8da9f6ccead028e5313d894d63b9575~k2b240cDa0774707747epoutp03W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523581982; bh=BR0O7iFL+asbzkBrte6Gz/NUA01t8sh8MPb2wWzRWkA=; h=Date:From:To:Cc:Subject:In-reply-to:References:From; b=qNJ02cvk5K0qni5f5YK4bcSC4r1DgcBHxinF0hJZ+DhmU90xUavI2VgDUer6a/haS XLH7A6S7CwqodtNCtELLneBg/xK+OsygbQGaWesKolo4ccMMVLGrHcYAK8mGpirKsC VHjeiGoLbkwdZR7kd/mERNQ/24IrwJEj3CjAdCXo= Received: from epsmges2p1.samsung.com (unknown [182.195.40.66]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180413011302epcas1p482cf867c945780320e8f2ad619003c64~k2b2fjYLp2994429944epcas1p4e; Fri, 13 Apr 2018 01:13:02 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 61.CF.04068.E1400DA5; Fri, 13 Apr 2018 10:13:02 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180413011301epcas2p1bce5cd878c247970bf3b7b6096d239de~k2b19huwR1671916719epcas2p1-; Fri, 13 Apr 2018 01:13:01 +0000 (GMT) X-AuditID: b6c32a45-6ebff70000000fe4-94-5ad0041ec6eb Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 16.21.03827.D1400DA5; Fri, 13 Apr 2018 10:13: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 mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7300HZTNDPOI30@mmp2.samsung.com>; Fri, 13 Apr 2018 10:13:01 +0900 (KST) Message-id: <5AD0041D.2050506@samsung.com> Date: Fri, 13 Apr 2018 10:13: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: <5AD001C5.2040406@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7bCmma4cy4Uog7/LxSyu9S5ktjjb9Ibd 4vKuOWwWn3uPMFrcblzB5sDqsXPWXXaPvi2rGD0+b5ILYI5KtclITUxJLVJIzUvOT8nMS7dV 8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBWqmkUJaYUwoUCkgsLlbSt7Mpyi8tSVXI yC8usVWKNjQ00jM0MNczMjLSMzGOtTIyBSpJSM2YNbmVrWAPT0XL162MDYxNXF2MnBwSAiYS d7Y/Zu1i5OIQEtjBKHG/7z8jhPOdUWLx9E9AGQ6wqvVH5SHiGxglXp45ygLSzSsgKPFj8j0W kBpmAXmJI5eyQcLMApoSL75MYoGov8so0d6ymgmkhldAS+LLNPEuRnYOFgFVifYUkGo2oOD+ FzfYQGx+AUWJqz8eM4LYogIREjvnf2MHaRQRSJZom6UJMdxKYtejPrASYQE3iR93e8FaOQW0 Jfov72GE+GoDm8SENYIQtovE3d+7oeLCEq+Ob2GHsKUlnq3aCPashEA70JF75zFDOFMYJc5d v8cEUWUs8WxhFxPEZj6JjsN/2SEhwivR0SYEUeIh8WzeHWYI21GiYe1CdojPrzBK3Lm2h3UC o9wspMCahQisWUiBtYCReRWjWGpBcW56arFRgaFecWJucWleul5yfu4mRnAC03LdwTjjnM8h RgEORiUe3orq81FCrIllxZW5hxglOJiVRHinPwYK8aYkVlalFuXHF5XmpBYfYjQFBvZEZinR 5Hxgcs0riTc0sTQwMTMzMjezACYucd4G3zNRQgLpiSWp2ampBalFMH1MHJxSDYzbzh9abxWw /57szc8rFErK/RY1NLT90O97IKIvyvPg5Pq0OA32eVEdrPN3Vv3ZeJ9dqO061524180d7AfK e4Wv9z1c9W9ayuUHL+85icmfL1q7SyQ3a+bTlY9a+x0+qz17X73rnsg/e73/Ibr1c23DlN8k L/67w/v9cuODOV+P3Vow/X1M/zRPJZbijERDLeai4kQAWUaLH3YDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t9jQV1ZlgtRBud26Vhc613IbHG26Q27 xeVdc9gsPvceYbS43biCzYHVY+esu+wefVtWMXp83iQXwBzFZZOSmpNZllqkb5fAlTFrcitb wR6eipavWxkbGJu4uhg5OCQETCTWH5XvYuTiEBJYxygx/8svxi5GTg5eAUGJH5PvsYDUMAvI Sxy5lA1hqktMmZILUX6fUeLr28nMIHFeAS2JL9PEuxjZOVgEVCXaU0BmsAEF97+4wQZi8wso Slz98ZgRpFhUIEKi+0QlSFhEIFliyvZudhCbWcBKYtejPrD1wgJuEj/u9rJBLLrGKDH75ikm kASngLZE/+U9jBMYBWYhOXMWwpmzEM5cwMi8ilEytaA4Nz232KjAKC+1XK84Mbe4NC9dLzk/ dxMjMGy3Hdbq38H4eEn8IUYBDkYlHl6FyvNRQqyJZcWVuYcYJTiYlUR4pz8GCvGmJFZWpRbl xxeV5qQWH2KU5mBREuflzz8WKSSQnliSmp2aWpBaBJNl4uCUamDkdaperXBy0mPP1zcyfLsX XEn5Ouvsxj8XepdnzX1Uayty/3CgueT3pZO+RqbmNOrfPDlfXmG3/8IbIsv/neA3vv9p+cEV +nmH3X0bVrA7S67ofZ+kldf/x2jqyqLXKQI7Fh6ZO2uGesIEY21lxkq7PV9mmWva/j9TOeNc mfOMqXJz6natk1NzVmIpzkg01GIuKk4EAJ/kRldXAgAA X-CMS-MailID: 20180413011301epcas2p1bce5cd878c247970bf3b7b6096d239de X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180330114418epcas5p1affd1c3d97e7422dd33e6d3ca73073be X-RootMTR: 20180330114418epcas5p1affd1c3d97e7422dd33e6d3ca73073be References: <5AD001C5.2040406@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018년 04월 13일 10:03, Chanwoo Choi wrote: > 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. Sorry. err_dev is correct instead of err_out. > >> } >> >> 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