From patchwork Tue Jul 4 17:06:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 115871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1364478vqx; Tue, 4 Jul 2023 10:21:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6skAkBp0gunqa7E3WcmXBqvd6a2u0RKS4KK1q5sLIjnMnvW2mhqieZD7tryYvNbMNrG4YR X-Received: by 2002:a05:6a21:6811:b0:128:f513:55ef with SMTP id wr17-20020a056a21681100b00128f51355efmr12949154pzb.38.1688491308972; Tue, 04 Jul 2023 10:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688491308; cv=none; d=google.com; s=arc-20160816; b=sX6x7cKphr/abLOe3ehywHovYV+ONNWngi0l8mVvjJKICIdqUe13fL6/qfSg2iuhA3 ZPBeth5hpdpPT7Qq3RYun7WoOZZk49NKd6ehLe0UBI79yZH6HESQD3C/gZVUK+ht6eot 3+qFpanc0aEceOALDwCTLdav6yZ0qsjQN/0Ywhp1TmdkBPvRRZuR09WizcCD2z3cZlso 68XMtn61lx7iGeWStr+g7ur5JQJSUcBKqW6/hSrlXYS59DYDEUU81Ebx/4z4uBdhpqgu GU8d7IOfUE0qboAyBDoHXoBG1X44nCaYPJcC0iJ2CzT2y/T1ntcZQw7W1w/j72nHThGC kMhg== 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 :message-id:date:subject:cc:to:from; bh=QrAlUx73ikm8U1ojrtrGtw77HIxhN1wwwleTxuCBmrw=; fh=SqCs7KZ8ytcbnkiRESvNRChZIthYOwhcUjFjEDfWP4k=; b=lznzna9alqoIufSDy18J3NGS0gzSKp/71eEyx/d/rxuBe7+oySLtePGkEGXpvIqea4 6FRIS4gDLC8Qg6R5iEqssAsbh82wKwYwSF3RRY5xoBroFvuPzowblxLFiBDq77bngpxW UM+XApBSSjL+H9bKy/pqZvsTo9YDLVh5uOnzjcEK81qlQh1Pff75kceTRgchhhEBNS+R Dnl7hFv5sw0fNIxng0t9uDyXUy1Y9PBjQv/wPIbrxqUiCLuGsj3HmwiB46Dzj+pflWNK 98JliRS/UrAl6x4rEn4anWkhovdT/RdPUijKvdH5d+NgMFTZ83mmD9BAuArhdxYrbxbm zS1Q== 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 y21-20020a634b15000000b0055af072945dsi17273144pga.812.2023.07.04.10.21.36; Tue, 04 Jul 2023 10:21:48 -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 S231851AbjGDRIc (ORCPT + 99 others); Tue, 4 Jul 2023 13:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjGDRIb (ORCPT ); Tue, 4 Jul 2023 13:08:31 -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 25776F3; Tue, 4 Jul 2023 10:08:29 -0700 (PDT) Received: from ipservice-092-217-072-126.092.217.pools.vodafone-ip.de ([92.217.72.126] 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 1qGjVr-0000ky-1q; Tue, 04 Jul 2023 19:08:27 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH] hwrng: imx-rngc - use dev_err_probe Date: Tue, 4 Jul 2023 19:06:44 +0200 Message-Id: <20230704170644.69669-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770511462505797786?= X-GMAIL-MSGID: =?utf-8?q?1770511462505797786?= Simplify the code by calling dev_err_probe instead of dev_err and return. While at it, use the same device for all error messages. Signed-off-by: Martin Kaiser Reviewed-by: Rouven Czerwinski Reviewed-by: Rouven Czerwinski --- drivers/char/hw_random/imx-rngc.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index bf07f17f78c8..e4b385b01b11 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -239,10 +239,8 @@ static int __init imx_rngc_probe(struct platform_device *pdev) return PTR_ERR(rngc->base); rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL); - if (IS_ERR(rngc->clk)) { - dev_err(&pdev->dev, "Can not get rng_clk\n"); - return PTR_ERR(rngc->clk); - } + if (IS_ERR(rngc->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n"); irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -272,24 +270,18 @@ static int __init imx_rngc_probe(struct platform_device *pdev) ret = devm_request_irq(&pdev->dev, irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "Can't get interrupt working.\n"); if (self_test) { ret = imx_rngc_self_test(rngc); - if (ret) { - dev_err(rngc->dev, "self test failed\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "self test failed\n"); } ret = devm_hwrng_register(&pdev->dev, &rngc->rng); - if (ret) { - dev_err(&pdev->dev, "hwrng registration failed\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "hwrng registration failed\n"); dev_info(&pdev->dev, "Freescale RNG%c registered (HW revision %d.%02d)\n",