Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp630781pxv; Thu, 15 Jul 2021 12:00:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAqZqjcMSK/B3tetSpdEWjwg+sIRpsf2+fhk7jBEt9KCI4UlIb5WskxvCcNX/mI8zKyDnB X-Received: by 2002:a92:a004:: with SMTP id e4mr3383072ili.299.1626375602551; Thu, 15 Jul 2021 12:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375602; cv=none; d=google.com; s=arc-20160816; b=ExR3tOa8vp5DSIaqsD6PUEUC7Q2SA/eljG+NPykztCKovBzavrFJ+Iv7Ow4KLgD5wl VIcjLUow8M8W3C0cSqU4pqQo5PYS65xE/1lP9l3/Q7qicgzlwt9vdK7zU3TbDNfG8Mr/ yoVUpuzKIz//4hcyHx1TFBij9lAkOpEmoC6hnlHex+dgAO8WkPywP6FYEQbVII++f8aY LGEinFb7vgxh7B8VkORMi0TdDwBRaBEJkF01L+u8Q5z8lIj1LJ8/BzlphipTLl9DZk8C T63waF8TqNlfArME+5RoBmzCHstZqxF0Z19zk/+Wq7y+qR89bbRatX/ijJxwu2E6o699 MVvQ== 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=nsqD7hOECkTkXdTGPzAZ8jdlPxsNjnIFYpkOR2izmcApjCxO/dQZ0zO6p3sCgYgH+e H83GdqCF8apPEhi7HY9dFCpAy9A6JfjXpfRAQbBimtQTMuVNL9icPZPYRS567ocH5EC8 LDMapnVKD5qWLXMGYd9Evz159oH/DgZScY3zYzhUhjLXAIV8V2+CMjM0Pq07i07sCAlH QvscAGHYZPo7K1F5CVz1BCHDb4HL92FQ+a0h3di+BWW6skHp0uRELH/7uBPzoq5d+igJ PualJbsr8Onsq+gGdtiDY2gzUMZgr0TQB4JL32lGxqN485aNepRC4Hm3nWms9tPWaaKc 0c6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XNNHqW/3"; 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 j23si8296132iog.79.2021.07.15.11.59.50; Thu, 15 Jul 2021 12:00:02 -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="XNNHqW/3"; 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 S241833AbhGOS70 (ORCPT + 99 others); Thu, 15 Jul 2021 14:59:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:56124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240025AbhGOSw1 (ORCPT ); Thu, 15 Jul 2021 14:52:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21352613C4; Thu, 15 Jul 2021 18:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374973; bh=oaC2icxJ1FzLUjUeegnixedcm9xmDZEyvww90mFno2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNNHqW/3O1gRkzLXwK5b3dgxgwx/i0TSVCSiCxd21512B3n4lCNuOlA5KM+s2tJeT llIIdwder0O05yLAmGF20maJE9Gofpf8HAv+svVfbn7BE7ICLGxw5ClGFdqlxrwn20 SWfdlYjLoMpn6YFwrlCVfQinwcfhf9UUXZP3LVV4= 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.10 063/215] net: moxa: Use devm_platform_get_and_ioremap_resource() Date: Thu, 15 Jul 2021 20:37:15 +0200 Message-Id: <20210715182610.578716738@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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