Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp639343pxv; Thu, 15 Jul 2021 12:11:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfIiZIBBkQTYSRuoCLe7qhxqG0ROjPDZe/Es7rsFssoTtNvuKfSVlgomeCx/2t0wm+Z+Mr X-Received: by 2002:a92:cb91:: with SMTP id z17mr3916592ilo.31.1626376265606; Thu, 15 Jul 2021 12:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376265; cv=none; d=google.com; s=arc-20160816; b=AJCtY39RmL1bnxBkWfFVfu0q5day54hPq9TKz9r2N+yVqKUPs64SNjjWgAf8H1yoyj P4e1UzJanELagzRgW+Oszd8XTBzt6KgjNQku3AZZODLgL6ng4NYIeJgcQyA3LElltI1W 0lTKzMIpYPGTOwo7VBfovQhhBXoKI744WSef0pnOm9rEfTMiaFcLqDg1fYvdfkCWRNRi bJ9wezf/FutLh/vScr8JCHE5inYciKotEj88MT7eb56GRE9yYZTl0c6aoBKRFZxCFL4C mUL3jncisPOHwTwq9d9JNapBosHolUzLYhgWcuywpCy82Dj0qURHrxccZKJ53ubKh9k3 IKdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BLGGURkN1uvopvzF7ToqxXOdq3uocmKcfKMEfxG4U2Q=; b=YZBe9e4Xw2zsuyh6sM7LKolc0wuNg9VcarghkPMK96ksjqEdAw+J1FrKlMK9cb6VD+ lEth3/xi4VNeA6hKRr4or4zdbtgU841q2zGBAwOKoFNQJHJV0etnhc+a2+jLVqgXfoxW DH2SeYv4+3kWRDfbK1V61ZnjYiUmVAUMzAh6U2np6ouhnigHcJCuvejZf/S8YkUTf1Iz CgdRtWhczO2R1SWhOjzMrlSzbp20cwHUjb3vACIlRW/nVfQRAGqruNHmsc7k+/AWr/rF vfGftQnsMEalHVGrogNgXZgFrwA9Bq2L8HxXpMidurJA/y47F8zCbJCaCsQh7t3rSUlA FKhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jwcp0s6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si8826131iov.14.2021.07.15.12.10.53; Thu, 15 Jul 2021 12:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jwcp0s6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241273AbhGOTMt (ORCPT + 99 others); Thu, 15 Jul 2021 15:12:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:38160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242135AbhGOTAl (ORCPT ); Thu, 15 Jul 2021 15:00:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6972E613D0; Thu, 15 Jul 2021 18:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375458; bh=oaC2icxJ1FzLUjUeegnixedcm9xmDZEyvww90mFno2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwcp0s6vw4oZarxvsU0KV9xCGLJyFYr2yRYyl/tgy0u1lih5e1XMYqo6JdUfj+xd8 jMNY+lAsmvC4BUJ6baIJKDZ9BKGCLZsOZ8OlrQjq0Vh5USYlQKCS4xadOs197wXmdz aZBXL58gcUflOUl+DaBW33X10aWOEpeuCAORNBR4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 069/242] net: moxa: Use devm_platform_get_and_ioremap_resource() Date: Thu, 15 Jul 2021 20:37:11 +0200 Message-Id: <20210715182604.693120995@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit 35cba15a504bf4f585bb9d78f47b22b28a1a06b2 ] Use devm_platform_get_and_ioremap_resource() to simplify code and avoid a null-ptr-deref by checking 'res' in it. Signed-off-by: Yang Yingliang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/moxa/moxart_ether.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index 49fd843c4c8a..a4380c45f668 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -481,14 +481,13 @@ static int moxart_mac_probe(struct platform_device *pdev) priv->ndev = ndev; priv->pdev = pdev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - ndev->base_addr = res->start; - priv->base = devm_ioremap_resource(p_dev, res); + priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->base)) { dev_err(p_dev, "devm_ioremap_resource failed\n"); ret = PTR_ERR(priv->base); goto init_fail; } + ndev->base_addr = res->start; spin_lock_init(&priv->txlock); -- 2.30.2