Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5563591ybl; Sun, 22 Dec 2019 08:51:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwxG+8FzmugLKN4YqRdfpSOQs+Xbo4TkbKg+S9pzBSsBc3hUsvmx2jRSFifHs7yG7jGtHDH X-Received: by 2002:a05:6830:1e8a:: with SMTP id n10mr16922749otr.303.1577033509435; Sun, 22 Dec 2019 08:51:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577033509; cv=none; d=google.com; s=arc-20160816; b=RMemLf1S9GEVgRkAq3Mcn6XQegZH+2XRhlJtsOv345lcdp8je+WhBUP+m/HHeNsyJq BPWMIPchxkDqaQMCgCZm4oNTM9xwqzN+ID/Ro5uJZGqZ9uYBSaBYqrJfC88vniXQ/u6D S05sGxC5s+msA4r3voSUJIS0FoCSm90V51eTc3EswRTmg+8lTusxhSyOGVD7k682Ujx1 68HYuWq1K5iWrg3POSxmnQZS0Ipj+wPdRgUJyHYu9Qun4PBNzTTZeHtjzqQrgNNR3umP Ckywxof02AYO6ZWi4/2LL+Vu8jb0DPTYQ/cdyac7YAIaqkdaUJ3IzvvZ9t9xWydg5VGN 0mIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7EAgraXdxVH/I9YgRO4Ldv5dflM6uIlkUexH7YW/TRU=; b=TY2LOa6rCYk3hLXwHA5T0UnP26A/FztcoF1zR3dY4WO5xCeVTgosu2ahg9jtzuky6i 1LUjzW0FNSsZlcOsqNEjj85LIDFB3d6HfUirsR/tl4CNE1qnYiRkmCLYzvs9vuek52H2 E35QsN6hRpSePtIH0Swtauzd/6j4u3vTNwJByWL8trjsP7KEjMpvS9/7O3AvUcIzCSQj 4moX9zycxaBAKXKS4ez4JHyreneybaOqZBgAQMz52ixxXFv7F1fkWv7t6NZ518RkXfA+ Y1Iq6E4LyrmnOcY/q0e+U/8g9edSWBS01cEiI+PvBJ7ofo/bhyLBgFO8ig/DCiwMwb5p pGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WdS5yxPm; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si6902718otf.285.2019.12.22.08.51.37; Sun, 22 Dec 2019 08:51:49 -0800 (PST) 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=@kernel.org header.s=default header.b=WdS5yxPm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726291AbfLVQtk (ORCPT + 99 others); Sun, 22 Dec 2019 11:49:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:38814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbfLVQtj (ORCPT ); Sun, 22 Dec 2019 11:49:39 -0500 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BDC22070A; Sun, 22 Dec 2019 16:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577033378; bh=zNwV6UcRWYyXPEtNmmpVjDoWHyX7Z1gcx8eFJmze8mg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WdS5yxPmd7RX9ltaK4Oge25rmUk44wOe0yd4V6/7qk1BRZTYlcDg8xn+6N8wdvQPr NlEMcuioxl8QWiP2mVUD69EIrOPzovxEMSWP3lpa4eeORQjsOJJlQijZbDZpthIXmx FgdRE6YjBFTm2YXH1k4O+oylhv0x15M9UYwnjH1o= Received: by mail-lj1-f174.google.com with SMTP id l2so15505686lja.6; Sun, 22 Dec 2019 08:49:38 -0800 (PST) X-Gm-Message-State: APjAAAU52rjvYOA6fm91y9A/g2X/bGQd+9PaEZbo5dpHnfWOfXMqNU0z xQ7SEbI37+yc77dciduA10zmAmMtCJurImLed4k= X-Received: by 2002:a2e:8551:: with SMTP id u17mr10521487ljj.165.1577033376732; Sun, 22 Dec 2019 08:49:36 -0800 (PST) MIME-Version: 1.0 References: <20191221181855.31380-1-tiny.windzz@gmail.com> In-Reply-To: <20191221181855.31380-1-tiny.windzz@gmail.com> From: Chanwoo Choi Date: Mon, 23 Dec 2019 01:49:00 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] PM / devfreq: rk3399_dmc: Add missing devfreq_event_disable_edev To: Yangtao Li Cc: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , Linux PM list , linux-samsung-soc , linux-arm-kernel , linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, 2019=EB=85=84 12=EC=9B=94 22=EC=9D=BC (=EC=9D=BC) =EC=98=A4=EC=A0=84 3:21, = Yangtao Li =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > The probe process may fail, but the devfreq event device remains > enabled. Call devfreq_event_disable_edev on the error return path. > > Signed-off-by: Yangtao Li > --- > drivers/devfreq/rk3399_dmc.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > index 2f1027c5b647..4f4e7c041888 100644 > --- a/drivers/devfreq/rk3399_dmc.c > +++ b/drivers/devfreq/rk3399_dmc.c > @@ -364,7 +364,8 @@ static int rk3399_dmcfreq_probe(struct platform_devic= e *pdev) > if (res.a0) { > dev_err(dev, "Failed to set dram param: %= ld\n", > res.a0); > - return -EINVAL; > + ret =3D -EINVAL; > + goto err_disable_edev; After jumping err_disable_edev, it calls the dev_pm_opp_of_remove_table(). it is wrong. It doesn't need to remove the table. > } > } > } > @@ -373,8 +374,10 @@ static int rk3399_dmcfreq_probe(struct platform_devi= ce *pdev) > if (node) { > data->regmap_pmu =3D syscon_node_to_regmap(node); > of_node_put(node); > - if (IS_ERR(data->regmap_pmu)) > - return PTR_ERR(data->regmap_pmu); > + if (IS_ERR(data->regmap_pmu)) { > + ret =3D PTR_ERR(data->regmap_pmu); > + goto err_disable_edev; ditto. After jumping err_disable_edev, it calls the dev_pm_opp_of_remove_table(). it is wrong. It doesn't need to remove the table. > + } > } > > regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); > @@ -392,7 +395,8 @@ static int rk3399_dmcfreq_probe(struct platform_devic= e *pdev) > data->odt_dis_freq =3D data->timing.lpddr4_odt_dis_freq; > break; > default: > - return -EINVAL; > + ret =3D -EINVAL; > + goto err_disable_edev; ditto. > }; > > arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0, > @@ -426,7 +430,8 @@ static int rk3399_dmcfreq_probe(struct platform_devic= e *pdev) > */ > if (dev_pm_opp_of_add_table(dev)) { > dev_err(dev, "Invalid operating-points in device tree.\n"= ); > - return -EINVAL; > + ret =3D -EINVAL; > + goto err_disable_edev; ditto. > } > > of_property_read_u32(np, "upthreshold", > @@ -464,6 +469,8 @@ static int rk3399_dmcfreq_probe(struct platform_devic= e *pdev) > > return 0; > > +err_disable_edev: > + devfreq_event_disable_edev(data->edev); It is wrong. It have to be called under dev_pm_opp_of_remove_table(). It ignores the sequence of exception handling. > err_free_opp: > dev_pm_opp_of_remove_table(&pdev->dev); > return ret; > -- > 2.17.1 > --=20 Best Regards, Chanwoo Choi