From patchwork Mon Sep 20 07:44:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12504765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C051C433EF for ; Mon, 20 Sep 2021 07:44:42 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1119C60F26 for ; Mon, 20 Sep 2021 07:44:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1119C60F26 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=xw5Tv1ko5jzHDXirAm/PsQW2eTdC1XY+DXIweTenYj4=; b=HofOvkZf43gDMH cv3PpxzDRWAc6r5o+KVa4HzgmluuvAx9d41rdz3i0ND2NfMLkBEU31W5/m7XRlWkrr6VM0mHhcqel A7g6daOB+qJwb9q/3RbxAZUcVeEhJIkFG5wobjSDmnZQR5c3eFcnZ6T5IH2jytTmSF5KNlOw/jfmJ 4VcldGIERQt4l2vKwvrBdOV7U1hQaq2Kkoeb9TYjbvSvfTwxt7swdM0/NADNTKvin2/4V52iuZ8di vJ5tI66YyFIvTLWg9JJ6AVbF/dIKQwP8M1AGmyMNf5EETrALFhGeWdLk/nOlnMGA88kyBoun6BEQB fALqcg2pj79BThV/JACQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSDyd-000oS9-Ji; Mon, 20 Sep 2021 07:44:35 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSDyO-000oNs-VH for linux-amlogic@lists.infradead.org; Mon, 20 Sep 2021 07:44:22 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSDyH-0005Z1-3J; Mon, 20 Sep 2021 09:44:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mSDyB-0006I1-Up; Mon, 20 Sep 2021 09:44:07 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mSDyB-0003GO-Te; Mon, 20 Sep 2021 09:44:07 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Matt Mackall , Herbert Xu , Neil Armstrong , Kevin Hilman Cc: Martin Blumenstingl , linux-crypto@vger.kernel.org, kernel@pengutronix.de, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet Subject: [PATCH v2] hwrng: meson - Improve error handling for core clock Date: Mon, 20 Sep 2021 09:44:05 +0200 Message-Id: <20210920074405.252477-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=9tz2phqeN+3GzCEXz8gh5AQWNocdSF32iWo28yTN+xs=; m=cX96ziEeAkJuDb6P9w+CtfXmQzh9pdqI3yrnaxyU0x0=; p=suObcorQD7ed5z2ooAXD8XsNDOU1xSrXgnghM0cQMIo=; g=768da396a3457f83adc357a91eec69259edb1cd1 X-Patch-Sig: m=pgp; i=u.kleine-koenig@pengutronix.de; s=0x0D2511F322BFAB1C1580266BE2DCDD9132669BD6; b=iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmFIOx8ACgkQwfwUeK3K7AnlGAf+KXe TSs5rrw7D8qxHbKDoi1ko2oXWIpazMMa4tZAhN3jY5JRqeFAwFkVljJALT8c03j5ylsbOgv+pQdxZ o5/MJqVr+wRetKulUJcDKc9JIzac8aA0dN0FTlF7/ZCBEnICh+BhtP4MXWD8OiyVAsS6L8y077DIb rNXmQFKLJ8j7ckNB39vsRia44FnL9omWskX93xZduLrcvJtOoPOGNtma6s1pZtP1J4RQHiRlP2Kau VShxiWEpxgDHeL9MpsP1PdN2kfEFXqYWusn8qAcII2gsZZV+hXIzbPlFXaCDJoBtd0WbO5bsDTno9 P0NRaxJxuQ8AeQ/EOK3wiPS140RKoEQ== X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210920_004421_048426_5B34994E X-CRM114-Status: GOOD ( 15.03 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org -ENOENT (ie. "there is no clock") is fine to ignore for an optional clock, other values are not supposed to be ignored and should be escalated to the caller (e.g. -EPROBE_DEFER). Ignore -ENOENT by using devm_clk_get_optional(). While touching this code also add an error message for the fatal errors. Signed-off-by: Uwe Kleine-König Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Tested-by: Martin Blumenstingl # --- Hello, compared to (implicit) v1 (https://lore.kernel.org/r/20210914142428.57099-1-u.kleine-koenig@pengutronix.de) this used dev_err_probe() as suggested by Martin Blumenstingl. v1 got a "Reviewed-by: Neil Armstrong ", I didn't add that because of the above change. (Hmm, my setup is broken, the b4 patch signature was done before I added this message. I wonder if this will break the signature ...) Best regards Uwe drivers/char/hw_random/meson-rng.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) base-commit: 7d2a07b769330c34b4deabeed939325c77a7ec2f diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c index e446236e81f2..8bb30282ca46 100644 --- a/drivers/char/hw_random/meson-rng.c +++ b/drivers/char/hw_random/meson-rng.c @@ -54,9 +54,10 @@ static int meson_rng_probe(struct platform_device *pdev) if (IS_ERR(data->base)) return PTR_ERR(data->base); - data->core_clk = devm_clk_get(dev, "core"); + data->core_clk = devm_clk_get_optional(dev, "core"); if (IS_ERR(data->core_clk)) - data->core_clk = NULL; + return dev_err_probe(dev, PTR_ERR(data->core_clk), + "Failed to get core clock\n"); if (data->core_clk) { ret = clk_prepare_enable(data->core_clk);