From patchwork Fri Jul 21 08:54:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 123675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp71996vqg; Fri, 21 Jul 2023 02:11:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1lxsDgd9VxJ71tSWl8LWvKo4qlfRN4bnzkQgOQTaRUw31UwX30ZNZNjhfeMLXEx8s7NLB X-Received: by 2002:a05:6402:752:b0:521:d2ab:e4df with SMTP id p18-20020a056402075200b00521d2abe4dfmr1356382edy.19.1689930718173; Fri, 21 Jul 2023 02:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689930718; cv=none; d=google.com; s=arc-20160816; b=WdJol5YmA49mTlK0r4f3zYvyhoGnow3r9vyv0TiHPqwL8JtyClmX08l5Xdsn05KkB3 jM0IjUceMqAOKh1PPNrfUgv9H3q4cvsvB3yz+bYwDQ4pZq2fjrluKASHT0UlmoOwzgCb TJRN0jcEd/o19uary9+Rfgz0ToGioPPUqPx1HSGkVffaVRfjMxdoWhrA6Q0cOzimcKST ld74cayz2DD5SBtUxn5EW1bSi4pydurVyZoLTGxCtRpFPm4hC/XLoAS6N2rxM/K51qWU Y99chklfkmHzleAwOJb6SHl23KekwA3iBBgl+yNxiI8k0POOsMW7/eWVSHfIIxUHY0jC b2uw== 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=cHc5wbfku0XmNwL0qpesEn4++LIBJPE9GEbFufxf1/E=; fh=dVfXhkbP60ZT4KVr26y6imwTSq8xUCJNaPCgpFL70HA=; b=wTgfsKI2dVvhL5i4o4V+4XQSdXkkCxBW7yebWKbQB02m8THRPlUhYboaI8Oxst7V6o WRg4D101fbzeHDvLT2oKETMVxPjUkfKnulOR9SuyrCmdpuUFcmpcYTp4Gh3AncBpspzA pL2GxVaw6/EyIdqYpNs8q+WnkEMlOGz7hWOL2xH49840hV/rQYyxDnXh91c0ykgK7o7K eYK6ZtsV8v6T1StF5nbOKdqdVkxGgvWOIRzdlj8n5r7VCS9ShAigG8aDs8GKyelTvXc6 R3Br2wIL/Uo2IzKFyo7qu8arpBci/6KYVbBk/OwU3le5Gbg6KlK9O1Z4VD5IDG9PuaDg 8e/A== 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 v23-20020aa7cd57000000b0051dec563f99si2187650edw.73.2023.07.21.02.11.33; Fri, 21 Jul 2023 02:11:58 -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 S231146AbjGUI5B (ORCPT + 99 others); Fri, 21 Jul 2023 04:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230290AbjGUI4u (ORCPT ); Fri, 21 Jul 2023 04:56:50 -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 0B2032D76; Fri, 21 Jul 2023 01:56:50 -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 1qMlwO-0001Cf-Lw; Fri, 21 Jul 2023 10:56:48 +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 1/2] hwrng: cn10k - delete empty remove function Date: Fri, 21 Jul 2023 10:54:43 +0200 Message-Id: <20230721085444.496863-2-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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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: 1772020792504214580 X-GMAIL-MSGID: 1772020792504214580 The remove function is empty, we can delete it. It's ok for a PCI driver to have no remove function. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/cn10k-rng.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c index 0cd7e1a8e499..794ec77feb2c 100644 --- a/drivers/char/hw_random/cn10k-rng.c +++ b/drivers/char/hw_random/cn10k-rng.c @@ -213,11 +213,6 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id) return 0; } -static void cn10k_rng_remove(struct pci_dev *pdev) -{ - /* Nothing to do */ -} - static const struct pci_device_id cn10k_rng_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xA098) }, /* RNG PF */ {0,}, @@ -229,7 +224,6 @@ static struct pci_driver cn10k_rng_driver = { .name = "cn10k_rng", .id_table = cn10k_rng_id_table, .probe = cn10k_rng_probe, - .remove = cn10k_rng_remove, }; module_pci_driver(cn10k_rng_driver); From patchwork Fri Jul 21 08:54: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: 123677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp76855vqg; Fri, 21 Jul 2023 02:22:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlH67iSzCWwoK5SWwa7rtNG3SHniAP3pbjfX56zZEk5jLFqfhstpXoYD+jSNoBJUB/kYSOAU X-Received: by 2002:aa7:c151:0:b0:51d:a181:d78e with SMTP id r17-20020aa7c151000000b0051da181d78emr1046322edp.27.1689931359157; Fri, 21 Jul 2023 02:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689931359; cv=none; d=google.com; s=arc-20160816; b=PUwDJx+1c+OM/OrMy7qqIImr7t7Olzdc99pvkhUVW6XJh1F77E29qEbJrYYWABFL4R KjqLUcL/j+T0y03dOuKe0L6geocCqFlSe2EuIwRKJtpOH8ajfgbPLBUsITQcftRnkpKf k+UdHhdSSrLLpeu68vJcXR1L1cSv3IcMGDjLM0ZTJN9qXhrF09006B4xLLpI+XT8Gi6+ GZNlihhV9C6C6CYWx0FSyaQn3wpnMh5YALZM76ce2U84FY4meim/ke+0jYO2Q+QQ2Lbq 9/QzishoRR0/1hRxrKoRhttMGP38Y6N3+xiUbTcd5Zj/6HKIyadXXr8HmrITgxMpZqwE JWLA== 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=GnwMUTVGa7CjGjizSsxZfosIZXoL3Kn+9CqIw2wq2Mtl040gNhSIEf/bA/cgvIjhFk sZ/uOz9gLf3+SfPJXgPbybfICvBs1pPR2t9bh9Rm2wygDly48GdaD7yrlEbv/3cQQJvA JNFLvi39ImvdeLZDb2gEKKbZweSyvHpjKKGnsNbAHDVz3iRA3g4ilQasMeGWv6F8BuZH d9v8NQl0zY4p0/NQvQWxfL5LDeDYTrWNrIe99SpHatGqEaD4dNE1W+gIMSe2LPBVvwsq xfOMMCfzsC0qTCUZSDCakGeqQGpQxuq8tVFsvqHU+WlKrr3to6fQUFgXWr9rZUqGSO52 0LNg== 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 z26-20020aa7c65a000000b0051dd487b0d6si2007358edr.361.2023.07.21.02.22.14; Fri, 21 Jul 2023 02:22:39 -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 S230395AbjGUI5G (ORCPT + 99 others); Fri, 21 Jul 2023 04:57:06 -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 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772021464610283355 X-GMAIL-MSGID: 1772021464610283355 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; }