From patchwork Fri Aug 25 14:24:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Sionneau X-Patchwork-Id: 13366045 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 B5DF1C3DA6F for ; Fri, 25 Aug 2023 14:25:07 +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: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=aZgAVukngUsb3cGuTHZoR32GKPN6kP+4rf5EpvQZdSo=; b=4/snsCwFrbFScE XW2LmqlMgE78hoIK+Q1CHvp3DGUhXQ4J+PQDN9MdnEW1MHVMS8M6SU2rWU3YMGpcjS8+PyIywCteT 7oAYuzk1gOFnEQ7QFHsN+kjqON/u9iNSsFfFiu2j8aO6hoghLqXbliBSe3tbQdi+BxOjcWAlmiEv7 bwXr6thNp2UNZYjCTP9IItOp5+MCPGR0TDWFPG6qatBL4iR2LO2BmcUn6FtQUEg0XrSgQ5PvbxkcO wj6/f//z5A9YVX5FmFyytDPWahXQ1Hkry1H95i3G1trgTY959k9G6aNgRe/GbqvHg79R/TOgrcrAY rEGR+v5Ax9eOrz9oNJtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZXjk-005asS-30; Fri, 25 Aug 2023 14:24:32 +0000 Received: from mx4.sionneau.net ([51.15.250.1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZXjh-005arP-1b for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2023 14:24:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sionneau.net; s=selectormx4; t=1692973459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Jaf5NgrM5yQG3fDgEPBnmr8NNF29E1ndjI5yLwiZ82o=; b=EJp2BMNZU8bT7lSHcTwelBpk6+nRLrxABYwfE8IX7yzhsb7GxxqluowFbWJy7Kw1pDWrR0 fVAjXRwZRSeXsQ8lTZOtuk+RsJeawVyPxK+lK2w/sfWWXS2ObFy3z3MI6ECMRsBeOGX2X6 JGK23WG1sCGlMvHmbLR7JGA5OIdfk60= Received: from fallen-ThinkPad-X260.home (91-171-21-26.subs.proxad.net [91.171.21.26]) by mx4.sionneau.net (OpenSMTPD) with ESMTPSA id 7ad8a692 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 25 Aug 2023 14:24:19 +0000 (UTC) From: Yann Sionneau To: Codrin Ciubotariu , Andi Shyti , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yann Sionneau Subject: [PATCH] i2c: at91: Use dev_err_probe() instead of dev_err() Date: Fri, 25 Aug 2023 16:24:15 +0200 Message-Id: <20230825142415.37476-1-yann@sionneau.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230825_072430_120069_B87A4729 X-CRM114-Status: GOOD ( 10.23 ) 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 Change return dev_err_probe() into if (IS_ERR(x)) { dev_err(...); return PTR_ERR(x); } Also, return the correct error instead of hardcoding -ENODEV This change has also the advantage of handling the -EPROBE_DEFER situation. Signed-off-by: Yann Sionneau --- drivers/i2c/busses/i2c-at91-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index 05ad3bc3578a..b7bc17b0e5f0 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -227,10 +227,9 @@ static int at91_twi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); dev->clk = devm_clk_get(dev->dev, NULL); - if (IS_ERR(dev->clk)) { - dev_err(dev->dev, "no clock defined\n"); - return -ENODEV; - } + if (IS_ERR(dev->clk)) + return dev_err_probe(dev->dev, PTR_ERR(dev->clk), "no clock defined\n"); + clk_prepare_enable(dev->clk); snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");