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: 118073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp61798vqm; Mon, 10 Jul 2023 13:43:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUYPBKdZ+bPH2ARxbOWxl71wbzt6QIEEULc/oZAEqgcIyzWXKt4g3iyezzcLeGSmzJW7sc X-Received: by 2002:aa7:d413:0:b0:51d:df35:3818 with SMTP id z19-20020aa7d413000000b0051ddf353818mr11246217edq.5.1689021832521; Mon, 10 Jul 2023 13:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021832; cv=none; d=google.com; s=arc-20160816; b=wfunZlGTIwAEhEKUFkBYhOr+uNoXrYWCmmVfWK/axLGP0pzAuGpg99lM50AHxGjMDF JJRT2MSPQ2CwBwcLFtOhencqwJsVUe2GPGlsKvZZwGBjLd1qxJ21eIg9xD7qUq+Xvdbt tMZFVIOIaIPdJgiI6dnGQyLr8AyzeSJiYjLfpFxwAvo61KFvLMWqPluBqYVhU2JucVLa lUqyrPeVR4UymjIZrM6HNrkhCkx1ehgX1TfOG3bQnbgvzxapfC8zye2s9QyDF+vS9Nnr Iq1UOrlHnHAnyqvPumsMQSlioK32kXKA0t7YIlBUWyax1AAUPrWDFbxF1MgHhVwVyGJM Bsyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wNwIp2eDLifUPKEudLKPIWNgOcmAOkLaJHe+IIHR+GY=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=dJ3Z6gIIgMTSTUAKzm6+RDDPniB5pc92zxl0ptYtJsMAVP8xkQ+2iq2R4ceMnm4KVk 6wF9cD0rw3AGW1kctqFMFdsRb+JQn9kC1QeQxScNPmM+RtZkM5kC5axhwZSy8oifAGSg U64+z+pxKFOscNzQyZ0SjXg8Vr1W16fzaE3EBKqYH5nyDhJ7vggvZ4Ka6NF7u+J0ihEm /eSQ1EhF9Q8dol5ftryEQa1ULFKK+NQhTwuluBx0ubJMfbDoIi11nTMbMrLfCsdQKeta nwjKc/WDvWzMa1dSyYZ2LATwqX9nloyxPqZMod0NaosqCxYJfVs2nwJiPW1IuFvDHfvw Hv7Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020aa7c1cc000000b0051e26731172si294756edp.672.2023.07.10.13.43.29; Mon, 10 Jul 2023 13:43:52 -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 S232382AbjGJU3s (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjGJU3f (ORCPT ); Mon, 10 Jul 2023 16:29:35 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367B419A; Mon, 10 Jul 2023 13:29:31 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771067756806905532 X-GMAIL-MSGID: 1771067756806905532 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);