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: 13321677 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 5755EEB64DC for ; Fri, 21 Jul 2023 08:57:20 +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=H9gAEBx5y4SENTC/4S+l8UW/n3Mw+WoM45rag1tlYEo=; b=F61x9CPeLN1/b3 5UkMq6mZEQlD5Yugm8umocLSO1MXXMlXdIHwOVLxxtPrfrKvBO+cVAkflmtE7zrThgQ0r8L3czaPk O2iHceIv/RnYWsoMB40tIN7JM1qUoN28v2frscO3zy3mOq4T4Bm4Gfs4DynWojORMWMPXpnLtEMKc IJL/y8rXbLbd49dWwk6Bf0rd8kX5ctakCnbLAFm1AbMxHFOIXwX7DU5R51kdpiERs7XQDSm4b/Jwq 4HWtdtZP3FLAeXZ1ATjJHi9an3xNlQuSV+bXqm5j8+aA9jGxdJUW3Lqg6XJcc689RiAhvq895M0V/ G0zD1r33CxfnUu79fwYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMlwc-00DS1A-1h; Fri, 21 Jul 2023 08:57:02 +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 1qMlwS-00DRxi-2j for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2023 08:56:55 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230721_015653_070917_72715F9F X-CRM114-Status: GOOD ( 10.32 ) 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 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: 13321678 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 75610C001DC for ; Fri, 21 Jul 2023 08:57:22 +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=7e3o3C+B7AdqCaON4vC95j6uBxtAWoAbjGpT2NXY/HU=; b=ctKufv9n2zWoPN R6HdS1tCBuotOMiDea4u9fYD0iwqQfbvNdQEkn8LwDvdLMAGQpMW/BN5UMaFa1lSqj1CgjmmR/ybM CaC6lTl0nZDyFpUO4zL9E0sg3BPzkChSJsbGDVywiJ0xYoOE3QazU91CxmBcEYFsDKXtg9ZcqvIU2 u4hVJ3f3W1gMmqHcmTY/n+/5Epp+d0VRWGTf6iRDR3ppaiSsgQQFmVwkgUT6mVx4n43gR+FpWYfC0 vE03Fh8S6zxvNwd/cJ+ZzGQf/eCE4aDLroSCIGJZppypcy1H7GmGRmxI5m83zES1ht/K0jDKqRzfn 6sUzPjV2vyPxVH81M5pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMlwc-00DS1c-38; Fri, 21 Jul 2023 08:57:02 +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 1qMlwT-00DRxw-0J for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2023 08:56:55 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230721_015653_279275_9A237712 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. 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 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; }