Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10626374rwp; Fri, 21 Jul 2023 02:11:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJ+gw3fBKySsJFGXktzvw2FI0vg+oHHl30nAfdfXjiHv4whbczWEocKSkeuxf7QupMt3mI X-Received: by 2002:a17:906:209e:b0:993:d617:bdc2 with SMTP id 30-20020a170906209e00b00993d617bdc2mr1142657ejq.75.1689930693024; Fri, 21 Jul 2023 02:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689930693; cv=none; d=google.com; s=arc-20160816; b=pKs+mlplaBTbf5WO20NBukIxcwvJ0Jnv5YEi9Ch+ul1DI1JO4a5QNpYuVVlVlYndHJ nlfP9GVY/l6Aaa50OwPlERbMGdHK7uBiybeGwXIggRLA4XHUqneTeaLUOiDiZM/QYmWw P9IeTWrDtBkh1B4jhelyZo88Ijvi6B4KzC1bvIG4vD9UoJABJsRPUEzQomp9l8SYnzF8 rHuaOOSJ21wRKqKWz1Otudq5sI68aQJ3KYFRYTpg/tvaaBdmYyHQlgj7hXy2J//3c7rK oQ0YWtfIJRjrG5Ntx9a/ENjHMwPiApng9CA318Ydykp4K0zD2XB7mfdd8HrNOF4cCuIV w+Hg== 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=TchN+vbC7ztP0We1HhswsczK8lMGIIaErEn11yabBCI=; fh=dVfXhkbP60ZT4KVr26y6imwTSq8xUCJNaPCgpFL70HA=; b=pMy306Es10WqFdmRMWAsUuTqH1OAkARJQtG046vDHwH5vQMGZaLB9527fTjy+IoFyH aNmpN3mf4IdSwSzRcp8Lducoro2RYGUgUsgN34xZ3/nqEX1QGcIxcE1keWXHbD+1AxKZ scK5G9ykjpmZqDQcbfOg9P8WprgN0qnw/M3bV/fBmYaAM6bC0vzKRjv5Ch0XaTdKDCXe YJsgn3tryYezfyttKJR1qx1EF5JZHMxLY9NyJFvrGjkcuUVg4xv77Y1JxcfbTUNc4icU SQO38PpenwgLqhTupEW48woXFmvwmT8OBZgOgw+MfLQD++6jZKFralo7MarGFb1Boc4j f3cQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 s16-20020a170906961000b009928b4e3b9esi1919995ejx.313.2023.07.21.02.11.09; Fri, 21 Jul 2023 02:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbjGUI5E (ORCPT + 99 others); Fri, 21 Jul 2023 04:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjGUI46 (ORCPT ); Fri, 21 Jul 2023 04:56:58 -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 AA9CC2D7E; Fri, 21 Jul 2023 01:56:51 -0700 (PDT) Received: from [185.206.209.215] (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 1qMlwQ-0001Cf-AK; Fri, 21 Jul 2023 10:56:50 +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 2/2] hwrng: cn10k - use dev_err_probe Date: Fri, 21 Jul 2023 10:54:44 +0200 Message-Id: <20230721085444.496863-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230721085444.496863-1-martin@kaiser.cx> References: <20230721085444.496863-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-crypto@vger.kernel.org Use dev_err_probe in error paths of the probe function, making the code a tiny bit simpler. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/cn10k-rng.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c index 794ec77feb2c..31935316a160 100644 --- a/drivers/char/hw_random/cn10k-rng.c +++ b/drivers/char/hw_random/cn10k-rng.c @@ -187,10 +187,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_drvdata(pdev, rng); rng->reg_base = pcim_iomap(pdev, 0, 0); - if (!rng->reg_base) { - dev_err(&pdev->dev, "Error while mapping CSRs, exiting\n"); - return -ENOMEM; - } + if (!rng->reg_base) + return dev_err_probe(&pdev->dev, -ENOMEM, "Error while mapping CSRs, exiting\n"); rng->ops.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "cn10k-rng-%s", dev_name(&pdev->dev)); @@ -205,10 +203,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id) reset_rng_health_state(rng); err = devm_hwrng_register(&pdev->dev, &rng->ops); - if (err) { - dev_err(&pdev->dev, "Could not register hwrng device.\n"); - return err; - } + if (err) + return dev_err_probe(&pdev->dev, err, "Could not register hwrng device.\n"); return 0; } -- 2.30.2