Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7826545rwp; Wed, 19 Jul 2023 00:24:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGeGWoybuNAQZ3WYCl44gX9wPOg43tZIQmYQzVjRExi/sPPQEsHXPNlrjw6x20Jduwn6HoB X-Received: by 2002:a17:907:2da7:b0:993:d1b6:61cc with SMTP id gt39-20020a1709072da700b00993d1b661ccmr1696995ejc.44.1689751485672; Wed, 19 Jul 2023 00:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689751485; cv=none; d=google.com; s=arc-20160816; b=vjc5pYtmmLn24GAtS8sVC7BIwSssIN6a3J1QQ2QCt/3ss+BHRsmanzqIonFAbDHfY6 18c95p5ALOuemRSEY54U1mnr30aPxHlQfex9TEpl33TXMwmMrRIU+EIgQwBYOZWbBRpR AVf8gs1AP+YSJl5JaP7J9I7LgmQ/RKJ0yBdRQuwzo7NKrZpa/iG7SUqoi3OT8u7dGaUS MiQo7l2qA+HFbMSyEMj2P/UEgOxUPxc1s6bkmpMMh1ecpuw9QQBnGnhzPsvEEHS7mtIT z7MPqu7RHNzacw0xj5/Jd+O0GvncRRwUJtuKqfbcDPGkIm5mo1FBZIw4M22S4PRpSLc9 vgkg== 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=krhIx6stVmnqk8f6UtEQLIGup/b8Y5GfesgupKU/U3s=; fh=dVfXhkbP60ZT4KVr26y6imwTSq8xUCJNaPCgpFL70HA=; b=KxzREZ8MzdoDIZCZfIQuOrvRTxG2BH8ZYLyXYXWMJXvzA+r5Ne5Va6utaNc5c3KP3w 0K9jfY7akHx4s26AQaGt+5pMl+lC5cd0DN13AOQmG11h8FyTTMDit8NtshgK8lwiH2eV ysTFleqsNEp70BWzxGfB2GLkmG4eDEajbSBO11GNMEM0CSwvPs8PY2vwjHK03a7GCFyr cVTCltWZUbTzQuMdx/uI5G1PRbBeH5jo8bF+dPD714+aqh1Jt+P6LvAw6atRy7HaoIrr uHhv7XTkktq3S5H87iQXPtIvMsFU2Bzpp7EkIeM5avlkhBtEs9Ohb3JY/cs2b6mgAYa5 46Sw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pv8-20020a170907208800b00992ca771e3asi2379763ejb.48.2023.07.19.00.24.21; Wed, 19 Jul 2023 00:24:45 -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 S229983AbjGSHU2 (ORCPT + 99 others); Wed, 19 Jul 2023 03:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229909AbjGSHUQ (ORCPT ); Wed, 19 Jul 2023 03:20:16 -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 14164E43; Wed, 19 Jul 2023 00:20:15 -0700 (PDT) Received: from ipservice-092-217-093-053.092.217.pools.vodafone-ip.de ([92.217.93.53] 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 1qM1Tp-0008I7-LB; Wed, 19 Jul 2023 09:20:13 +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 4/4] hwrng: cctrng - use dev_err_probe in error paths Date: Wed, 19 Jul 2023 09:18:06 +0200 Message-Id: <20230719071806.335718-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230719071806.335718-1-martin@kaiser.cx> References: <20230719071806.335718-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, 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 Use dev_err_probe in error paths to make the code a bit shorter. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/cctrng.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c index 2a1887f6483f..1abbff04a015 100644 --- a/drivers/char/hw_random/cctrng.c +++ b/drivers/char/hw_random/cctrng.c @@ -485,10 +485,8 @@ static int cctrng_probe(struct platform_device *pdev) drvdata->circ.buf = (char *)drvdata->data_buf; drvdata->cc_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(drvdata->cc_base)) { - dev_err(dev, "Failed to ioremap registers"); - return PTR_ERR(drvdata->cc_base); - } + if (IS_ERR(drvdata->cc_base)) + return dev_err_probe(dev, PTR_ERR(drvdata->cc_base), "Failed to ioremap registers"); /* Then IRQ */ irq = platform_get_irq(pdev, 0); @@ -497,10 +495,8 @@ static int cctrng_probe(struct platform_device *pdev) /* parse sampling rate from device tree */ rc = cc_trng_parse_sampling_ratio(drvdata); - if (rc) { - dev_err(dev, "Failed to get legal sampling ratio for rosc\n"); - return rc; - } + if (rc) + return dev_err_probe(dev, rc, "Failed to get legal sampling ratio for rosc\n"); drvdata->clk = devm_clk_get_optional_enabled(dev, NULL); if (IS_ERR(drvdata->clk)) @@ -513,10 +509,8 @@ static int cctrng_probe(struct platform_device *pdev) /* register the driver isr function */ rc = devm_request_irq(dev, irq, cc_isr, IRQF_SHARED, "cctrng", drvdata); - if (rc) { - dev_err(dev, "Could not register to interrupt %d\n", irq); - return rc; - } + if (rc) + return dev_err_probe(dev, rc, "Could not register to interrupt %d\n", irq); dev_dbg(dev, "Registered to IRQ: %d\n", irq); /* Clear all pending interrupts */ @@ -531,17 +525,13 @@ static int cctrng_probe(struct platform_device *pdev) /* init PM */ rc = cc_trng_pm_init(drvdata); - if (rc) { - dev_err(dev, "cc_trng_pm_init failed\n"); - return rc; - } + if (rc) + return dev_err_probe(dev, rc, "cc_trng_pm_init failed\n"); /* increment device's usage counter */ rc = cc_trng_pm_get(dev); - if (rc) { - dev_err(dev, "cc_trng_pm_get returned %x\n", rc); - return rc; - } + if (rc) + return dev_err_probe(dev, rc, "cc_trng_pm_get returned %x\n", rc); /* set pending_hw to verify that HW won't be triggered from read */ atomic_set(&drvdata->pending_hw, 1); -- 2.30.2