From mboxrd@z Thu Jan 1 00:00:00 1970 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 57807C71153 for ; Mon, 28 Aug 2023 08:04:34 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6tmZZZBwzPJql9O/nliXPUJFOusgF4w4eBaAoznneXo=; b=PW8uYISvrx2Efo qI09e2ReVAYnz+SgJGnX3QvOH83Z+p/avnrhmCAtrzFpo3KwreNpEkoPeCIWHYI40NfMYBjvS+nAo BYuCHhRq0ncp0j9Zks8nWodweeNDKkz0FbFgMDipiDFqpcx9Wq5dx5DL1XjzsRJsydBtWZ0KmrjpN Fl8r/fx0AvRFIUrDxl+dmSTqYqooiXU36GKpm/+GmnJsPKPYM8l2XWX1iEWzp2pnF6ftMw17MDqLT f9gq65Rhi2aQ5gOxv3FCNGvXpClndCZwRz+w6nNmyEl5QHJefJrwqobzPO16+lDWaQNPk8Xuz/zp5 Ag7EL/Io1RWq0fMCFbsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qaXEA-0096YA-2J; Mon, 28 Aug 2023 08:04:02 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qaXE7-0096X0-1X for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2023 08:04:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1693209839; x=1724745839; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=W6UvRcQNcknRhKMqAymfgYVMc/oAF9o4ms5wsMxD9pw=; b=foGUUdrFtnyba0mvU+1aTQGnZw8K4FPF9tY6mP4gxoyDimI87u4/O/3h jjYks3q5QFaLYvHhyi0KxqVt8wlmybE9BlDtGwX6TN/lZMahgkDU5mwKp uRuPS7tD6fU/NsmMzNdy7+FZTCJzoCv8O5/7t6snprZ5IFSEjKOzmn6OD rKBWM4yXmMvoACj85F7XAQK5CFIADThabMYXTzDwoWmNgMDjahYSpSMln mc0EsY1SyJjtMaF6lKxRouxAMx4ePgK/r7hGtkoAGHhxNi5bwVmssJKpA MExwWY6SNoL4MuQRVv0o2yXO/Z9YjmNx2vxoDt5oqCpEg6qUBVvXeShA9 g==; X-IronPort-AV: E=Sophos;i="6.02,207,1688454000"; d="scan'208";a="1641246" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Aug 2023 01:03:53 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 28 Aug 2023 01:03:24 -0700 Received: from [10.159.245.205] (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Mon, 28 Aug 2023 01:03:23 -0700 Message-ID: <5c680292-bcfe-881a-1c23-299c05b377ee@microchip.com> Date: Mon, 28 Aug 2023 10:03:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH RESEND] i2c: at91: Use dev_err_probe() instead of dev_err() Content-Language: en-US, fr-FR To: Yann Sionneau , Codrin Ciubotariu , Andi Shyti , Alexandre Belloni , Claudiu Beznea CC: , , References: <20230825143234.38336-1-yann@sionneau.net> From: Nicolas Ferre Organization: microchip In-Reply-To: <20230825143234.38336-1-yann@sionneau.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230828_010359_569396_A30E65B5 X-CRM114-Status: GOOD ( 18.39 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 25/08/2023 at 16:32, Yann Sionneau wrote: > 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. Is it found using a tool like Coccinelle or you just ran into it and figured out it could be good to change? Regards, Nicolas > 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"); > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel