Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2046245rwa; Mon, 22 Aug 2022 00:41:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5siFDRGhmZvu6zDa6E+V1VjLvgqteL2cZlJ0otp6Bu7OY9ZwDJ92NmMA3e5dwaKphXKQCO X-Received: by 2002:a05:6402:2381:b0:446:7a73:e704 with SMTP id j1-20020a056402238100b004467a73e704mr151618eda.244.1661154116209; Mon, 22 Aug 2022 00:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661154116; cv=none; d=google.com; s=arc-20160816; b=jMy6rYL4NrxPIoIl/xeivdl++CWKeZBJ20UZbknQZ4Bgu4T39Rff+i0QJRKMQ7O6Cy 5BaP1V/eyQw0YluPrCfL/sBzkUnRAXOm7gYgHRlzCIJWZD9nmsFr1LDJYyiRNlhnLpOB 5oXfWQiv1Ra7OPVzZH4e20pa7PRMlCwO/zCAMvCbg0BGSHcmIZrHAaVmPejufWwpWyJY vKqe14AwexOt8IKrc7vY01LctwQNPzZOxVqsWoBX1ygk/zlMw+7wFVb41Z49Cjky+D2P oxpllHuZnCQvXwmfik9aRe1ND50WO/vqa6TSlBPCbenliUbjITinDK/xe5jIcObEqcXz SU3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=FFcczktKk0OaUnZxRnjaa4tHajYlgsw7f3ubOBgNS8c=; b=uzDQ7kTL5emChApleM4n0rJPY9mDlP8KxLP7vAXnS76PW3Qe4b6m/JKAhp86/Q9xoc Cdl69gN5qNwrfKdh86POBVHq7fHARxamrHtrp49zsQg2URyn5L1g1RWhJQAhyaz3xwnT iSZBVKMq4AoWrki5K1GqAkb7nzbT/qI35WkrmIpiZZRe92oCikAQj7WVAJBOKDSXMlFK OGEMNmzFmD7+WRiXK12M0/n8BGwFu251JJ6+yQHxI159QM4KdS5Vp+4NZAYblLLctF4/ NI5vhIoFChaV47j7Ix0xVUdS70cJojjkmo+j7sEdnyuGFG7bx/Y2tmJE14diNVejNkIZ fRug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a1709066c8200b00738a50268d3si1235071ejr.417.2022.08.22.00.41.30; Mon, 22 Aug 2022 00:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbiHVH3a (ORCPT + 99 others); Mon, 22 Aug 2022 03:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233136AbiHVH31 (ORCPT ); Mon, 22 Aug 2022 03:29:27 -0400 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E542A401 for ; Mon, 22 Aug 2022 00:29:26 -0700 (PDT) Received: from [192.168.1.18] ([90.11.190.129]) by smtp.orange.fr with ESMTPA id Q1s6ofUmvLFqbQ1s6oZUKW; Mon, 22 Aug 2022 09:29:23 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 22 Aug 2022 09:29:23 +0200 X-ME-IP: 90.11.190.129 Message-ID: <66333c4d-8e8b-22a0-0c05-b72e2db2d3ca@wanadoo.fr> Date: Mon, 22 Aug 2022 09:29:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v4] pwm: rockchip: Convert to use dev_err_probe() Content-Language: en-US To: zhaoxiao , thierry.reding@gmail.com, heiko@sntech.de Cc: u.kleine-koenig@pengutronix.de, linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220819092627.19416-1-zhaoxiao@uniontech.com> From: Christophe JAILLET In-Reply-To: <20220819092627.19416-1-zhaoxiao@uniontech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 19/08/2022 à 11:26, zhaoxiao a écrit : > It's fine to call dev_err_probe() in ->probe() when error code is known. > Convert the driver to use dev_err_probe(). Hi, just a last comment below. > > Signed-off-by: zhaoxiao > --- > v4: add the missing dev_err function. > drivers/pwm/pwm-rockchip.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c > index f3647b317152..e6ee14c6a159 100644 > --- a/drivers/pwm/pwm-rockchip.c > +++ b/drivers/pwm/pwm-rockchip.c > @@ -328,22 +328,16 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > else > pc->pclk = pc->clk; > > - if (IS_ERR(pc->pclk)) { > - ret = PTR_ERR(pc->pclk); > - if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "Can't get APB clk: %d\n", ret); > - return ret; > - } > + if (IS_ERR(pc->pclk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(pc->pclk), "Can't get APB clk\n"); > > ret = clk_prepare_enable(pc->clk); > - if (ret) { > - dev_err(&pdev->dev, "Can't prepare enable PWM clk: %d\n", ret); > - return ret; > - } > + if (ret) > + return dev_err_probe(&pdev->dev, ret, "Can't prepare enable PWM clk\n"); > > ret = clk_prepare_enable(pc->pclk); > if (ret) { > - dev_err(&pdev->dev, "Can't prepare enable APB clk: %d\n", ret); > + dev_err_probe(&pdev->dev, ret, "Can't prepare enable APB clk: %d\n", ret); As in the previous patches, %d and the final ret are not needed. dev_err_probe() will already display an error code in a human readable way. > goto err_clk; > } > > @@ -360,7 +354,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > > ret = pwmchip_add(&pc->chip); > if (ret < 0) { > - dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); > + dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed: %d\n", ret); Same here. Otherwise, LGTM. CJ > goto err_pclk; > } >