From patchwork Thu Apr 6 17:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13203779 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 35742C76196 for ; Thu, 6 Apr 2023 17:31:20 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mGk/QU55skgmtXY5atTzAYyN0FDN9RaSeONYsZc9aCg=; b=ROF3c3EvUgff6S fY5cZrrE8ZPBvie55uYuMC8ZhqXArHd3ASQGrJEQDF3OY9BUneq5v/e7LisWBWLfZytW7gOZ7RAHD vnT6rzpU7PSrYESQZuqKMnuFmyC2SwqJrRoHeaHbx8pm3LcLaiqAldd9Ox6lgC9edFn6fDVa0QVzI HEChqScWc1jkjBhJ1tM5I3+2+rLlrMQZuKGMDL+7fAeA0cIH6knoNmaub9mlRcTSVdaQCqy5ePeyn CvxabLjVuy0BRitYrZv0Hr/9uV+sQxIhwejeBCgsPslEit5DJwTGwNBMhtt0k15v7G9GbVl+5OYSW BdyJyYsA30EqBgqthfHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pkTRL-0088lw-0g; Thu, 06 Apr 2023 17:30:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pkTRG-0088kv-1E for linux-arm-kernel@lists.infradead.org; Thu, 06 Apr 2023 17:30:23 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 019F564A7B; Thu, 6 Apr 2023 17:30:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763E8C433EF; Thu, 6 Apr 2023 17:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680802221; bh=uTezeCfzpYKuhuhU2D8QgaY4IY+HPF1/VqkokcAEH/s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=asWJygQgC55dAkjx6udpdZntn9zuHt+kcQ0wgfPkXijrhvumhv4d/EdkWjZEHE7N+ yQ9SaMwOJrnlBbTp5gMzf0WuZR6An4wuvhlKq2VTDDN7QWKJ+PFershPATGcWAZqHO 5W9BmCuXhTOb73ykf4CFUIIX0dMjlDlXoa9Y7finaHR447+dLH1oGzE4KthCFZNQB4 OWacI/iuswF2dqqdr+nS1SlS0t6eDREd4RYsfrZ9UgjrnpVaGChDZqcNkroTRPYeUe P7+WiNdpj3HseW4keCiCN2oq67bx0VL2IAwOaid3tZFAg5Q0KAeMJRz0UhxcaRM9M1 A6OsHLO0kcUkA== From: Simon Horman Date: Thu, 06 Apr 2023 19:30:10 +0200 Subject: [PATCH net-next 2/2] net: stmmac: dwmac-anarion: Always return struct anarion_gmac * from anarion_config_dt() MIME-Version: 1.0 Message-Id: <20230406-dwmac-anarion-sparse-v1-2-b0c866c8be9d@kernel.org> References: <20230406-dwmac-anarion-sparse-v1-0-b0c866c8be9d@kernel.org> In-Reply-To: <20230406-dwmac-anarion-sparse-v1-0-b0c866c8be9d@kernel.org> To: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.12.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230406_103022_454388_E3BFB1CC X-CRM114-Status: GOOD ( 13.48 ) 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 Always return struct anarion_gmac * from anarion_config_dt(). In the case where ctl_block was an error pointer it was being returned directly. Which sparse flags as follows: .../dwmac-anarion.c:73:24: warning: incorrect type in return expression (different address spaces) .../dwmac-anarion.c:73:24: expected struct anarion_gmac * .../dwmac-anarion.c:73:24: got void [noderef] __iomem *[assigned] ctl_block Avoid this by converting the error pointer to an error. And then reversing the conversion. As a side effect, the error can be used for logging purposes, subjectively, leading to a minor cleanup. No functional change intended. Compile tested only. Signed-off-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c index 2357e77434fb..9354bf419112 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c @@ -68,9 +68,9 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev) ctl_block = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(ctl_block)) { - dev_err(&pdev->dev, "Cannot get reset region (%ld)!\n", - PTR_ERR(ctl_block)); - return ctl_block; + err = PTR_ERR(ctl_block); + dev_err(&pdev->dev, "Cannot get reset region (%d)!\n", err); + return ERR_PTR(err); } gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL);