From patchwork Fri Aug 25 14:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Sionneau X-Patchwork-Id: 13366049 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 B68E3C3DA66 for ; Fri, 25 Aug 2023 14:33:14 +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=Zt98zRq+7J9QaDRJUgb9YAan+iyXczGrcvhqURLGXzk=; b=tv03tTzwdTyVAZ /DBdHuvHzbCnYWv8d1adVo6uYIpy8VKi9/PrBNzNnq0++eZcPKdpgOyDmID5zPcaYBniqVroYC6J0 dkU4owaGtmZyo0n2fClYV4jsLZsC+M2WeQbBECdsJO5ko4c2jvIrHvxD9LIhDS2H9hUWNtn8ZHXcD 2X6zcxOorayU7JQfY+1je3/T9etBMV7jMuzVJkP95uK5piE0OdHjAYY+RNSY0IG8s8ughNczvZNzs H09vM816aAg+ngHrc1qx7BvWfiWmGUY2fkOP37xJz6avCx9iyEFpTUP8SW6qrnFTKYote9WHLpa0D 0dRgaNBW3EpPfJwEt5xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZXri-005bgU-2L; Fri, 25 Aug 2023 14:32:46 +0000 Received: from mx4.sionneau.net ([51.15.250.1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZXrf-005bg6-1j for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2023 14:32:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sionneau.net; s=selectormx4; t=1692973961; 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=pg0LPNhgEAv4Ly7OVC5nrMKlmylfbzb/lgRhbAfYgQ8=; b=r8uCJFfxzrnu5eJfmggp7Zncg2yv/btUedOd9MKS+PuUamj2rIzuvOResjFacNLGJFdc76 fLCXtwVl39vlT/SHnrU/1q1x03GMMYyr5r62q/4SsB7Sigyzv0K+WvBAxM3XW9V+cfhzda 4KgkE54GBVqZ1lTkeu5dxJE5JzKWTKc= 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 1d4ade5f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 25 Aug 2023 14:32:41 +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 RESEND] i2c: at91: Use dev_err_probe() instead of dev_err() Date: Fri, 25 Aug 2023 16:32:34 +0200 Message-Id: <20230825143234.38336-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_073244_164794_472C511F X-CRM114-Status: GOOD ( 10.22 ) 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 if (IS_ERR(x)) { dev_err(...); return PTR_ERR(x); } into return dev_err_probe() 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 Reviewed-by: Andi Shyti --- 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");