Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp110294pxa; Mon, 10 Aug 2020 20:32:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRtlcRhm1uUU0LUSY77QtaQztjhVEnC0MOTGTvrTuGNPLtwk5GOYXn+Xlf/pK3OtB379qF X-Received: by 2002:a17:906:4a4e:: with SMTP id a14mr24970992ejv.450.1597116748152; Mon, 10 Aug 2020 20:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597116748; cv=none; d=google.com; s=arc-20160816; b=rARdoZhhYy3QH8Pa8izheFtR6QKf0QHl+osmk6mYyFSnL1Sny1KqebmQdPYxZEzpXh SxXF12sekqadCtswx5W9u+C/5iq7UDPXn+c7GMh3eMujf7z7aW6dhTQ+hh6MBYpRLmmO pt5VFRcgFgWTMZY/O8hDr+r1jG7fcvEg89u/AOkb7iH8Wb5mwuOoe3Tx7azUKLVUONVp yQG8EhoUi1HFca4jzo4lJi49ApN6YTu/zGWdOvhfMF1lVL58HPHZf/xxMRKlTye0vYud G2J3VThylN2XyLME0iV0lFYeUnX21WZW5sps0tJlpHHJktc01+BoayFEdSaRPTAcBfrB yCKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8AX1MzPxpE/VgLWcFz7VaSAhtZC3UkrY4dEIeIKRrEw=; b=F971n9AKxVf/9mk71sgGNLAfDQTh0s3C6OaQnDqM/qVOlxfCfCrzDK3BwrOYAeNt4W gYjzVaU1sucYgL4xTL4oWmlAEt3uWjs58LPZnZu3YRrMaIeXzMqnWGmI0pKqsUl20iGZ Q4KWjk77GMjtFfn+51KyR/+zNKHs5R0+laIm9rzY/NkZSxlxpsz6Jwng+DzmB3Y5WJoo G72ebvR55BMUl2A074ZIxKG9FmaW6IrlX+YDMoYB/5EyECIwJX8nxQcRdFbe/SeS7g2M 2Xu3VFygtedhSZ08+gNwuMXuU2tLuVxcebPL/HSZBGlqGv3IpWS7VWq+DaroKykyXNFC IDSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si11947708ejm.385.2020.08.10.20.32.04; Mon, 10 Aug 2020 20:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728105AbgHKD2n (ORCPT + 99 others); Mon, 10 Aug 2020 23:28:43 -0400 Received: from inva021.nxp.com ([92.121.34.21]:48460 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727819AbgHKD2n (ORCPT ); Mon, 10 Aug 2020 23:28:43 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F0D9C200725; Tue, 11 Aug 2020 05:28:41 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 85E06201D74; Tue, 11 Aug 2020 05:28:37 +0200 (CEST) Received: from 10.192.242.69 (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B047140243; Tue, 11 Aug 2020 05:28:31 +0200 (CEST) From: Anson Huang To: thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de, lee.jones@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH 1/3] pwm: imx-tpm: Use dev_err_probe() to simplify error handling Date: Tue, 11 Aug 2020 11:23:42 +0800 Message-Id: <1597116224-26221-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev_err_probe() can reduce code size, uniform error handling and record the defer probe reason etc., use it to simplify the code. Signed-off-by: Anson Huang --- drivers/pwm/pwm-imx-tpm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c index fcdf6be..e46fad3 100644 --- a/drivers/pwm/pwm-imx-tpm.c +++ b/drivers/pwm/pwm-imx-tpm.c @@ -350,13 +350,9 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev) return PTR_ERR(tpm->base); tpm->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(tpm->clk)) { - ret = PTR_ERR(tpm->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "failed to get PWM clock: %d\n", ret); - return ret; - } + if (IS_ERR(tpm->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(tpm->clk), + "failed to get PWM clock: %ld\n", PTR_ERR(tpm->clk)); ret = clk_prepare_enable(tpm->clk); if (ret) { -- 2.7.4