From patchwork Mon Jul 10 20:27:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13307589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3085CEB64DA for ; Mon, 10 Jul 2023 20:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/X5esC3b7RQ3t7AQCEDRTobfq3p8baazEHCzfwPLMcc=; b=jelFQOG+zA/EdN 2dBi2WNIveYyd5ADVerMaUBqK7qBeN1SrcqZYdkqjwKAC3P6cPQC7q3UQuJUh+LVWaa+Z3rIBOUBH v2M66yQlqxgzZaiCRV08Gx5yix+tj/CYsFlOr1Wi5w5xf314SdD3/MN9QOMXyrscwm3tyRzr2r6CD 4M7poAI39trVHYN9plOUHMEpYMcEs2p6A4ZyOZEgrhEJdxmcfZjhcsCpHZJdlVMM1xQ3NKyGEFmAm 0GXR3JXyUzUIJXH41IzqC5RjQEVYi7dYcByr0uhZfeFZKtTzhrVrrnYUiO2lRUrylmWl2ahmWG+3C wLDPS1x7LyVeBHJVlYsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qIxVv-00CfRR-14; Mon, 10 Jul 2023 20:29:43 +0000 Received: from viti.kaiser.cx ([2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qIxVm-00CfMT-0f for linux-arm-kernel@lists.infradead.org; Mon, 10 Jul 2023 20:29:37 +0000 Received: from 250.57.4.146.static.wline.lns.sme.cust.swisscom.ch ([146.4.57.250] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1qIxVg-0002mg-FV; Mon, 10 Jul 2023 22:29:28 +0200 From: Martin Kaiser To: Herbert Xu Cc: aric.pzqi@ingenic.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 5/7] hwrng: ingenic - use dev_err_probe in error paths Date: Mon, 10 Jul 2023 22:27:31 +0200 Message-Id: <20230710202733.116133-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230710202733.116133-1-martin@kaiser.cx> References: <20230710202733.116133-1-martin@kaiser.cx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230710_132934_393545_594F7DA2 X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe in error paths to make the code a bit shorter. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 906fa78de47e..cc88a941c929 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -84,16 +84,14 @@ static int ingenic_trng_probe(struct platform_device *pdev) return -ENOMEM; trng->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(trng->base)) { - pr_err("%s: Failed to map DTRNG registers\n", __func__); - return PTR_ERR(trng->base); - } + if (IS_ERR(trng->base)) + return dev_err_probe(&pdev->dev, PTR_ERR(trng->base), + "%s: Failed to map DTRNG registers\n", __func__); clk = devm_clk_get_enabled(&pdev->dev, NULL); - if (IS_ERR(clk)) { - pr_crit("%s: Cannot get and enable DTRNG clock\n", __func__); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "%s: Cannot get and enable DTRNG clock\n", __func__); trng->rng.name = pdev->name; trng->rng.init = ingenic_trng_init; @@ -101,10 +99,8 @@ static int ingenic_trng_probe(struct platform_device *pdev) trng->rng.read = ingenic_trng_read; ret = hwrng_register(&trng->rng); - if (ret) { - dev_err(&pdev->dev, "Failed to register hwrng\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n"); platform_set_drvdata(pdev, trng);