Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp652426pxv; Thu, 15 Jul 2021 12:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywhzkvWTcB16Yynp+tzpz9tiZ9ZYaf1+eVLrNc32p3ZhSuwZJ7vkYCasW5CXHwKSXHiwSu X-Received: by 2002:aa7:c9d8:: with SMTP id i24mr9322136edt.79.1626377517847; Thu, 15 Jul 2021 12:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377517; cv=none; d=google.com; s=arc-20160816; b=aMelsxM8nOpPEHzlE0/Z1j4VcrinKMu8UfXOAH4mR1qThLdHAubfYfYtSe4gShJjXp wrd0ran1UeFHCV6f3glt8P64Kq3uWewfdAP9CVpXViGDUHFTSbS+lYh1k5yCkdqcYRD3 j+SgfmY3/2M4iMxAwRK2iRxe9KOKGfslKuuD+VYxxiTsjzDBDuXjwAfhW6wh7yUZFA7c 9gWRFfZRKa11dO7QPFdge1Kef0Re+1oyS2g1W2p8Pr3u2z13R4xRKdgwFMh6t591KR4a 8eXHbhsogYhZqpBOtF8c/ODj1RaIO7Jc7WwYE06F8MTuCfT7MdHSxorhpHqrX/MSAUet SYiA== 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=BMSuT+EI33otOBL4C4sWtdrzoaI8w5PcTl9rTVBW6WI=; b=OM0Wbk+wTysJ0Ajy+LSpeZ6yzGO+cqeCzTxFtURFWrASJHmtQZR6wj8PeSAl7xzh26 2l1Ky+CFfpuZ4rz6PC8EtACGEuJ+TeS1iqKqrnlcfo8mTzyzT3AUHTZkyE7pYul8e0mE ggegFGugyAsaOyqNeK4sDrMoztW6mIAbuNHRw8bubShwC27KWjMX9h6fTppdDqLLRq+1 NFj9Lw8cWApdrwTO/pZ6n53qkpLx2hDnjL/evj2H0+52hD5cyBvxw5YsGnauC/iDhrDO Bu+BGIXcKVNDbc4jXWA5Cj4DdmtUc04cO/BM11f6/LU1aA2cffcjG7vR7uRuumHnK6Ts QZkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SecMYueb; 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 qo10si8266309ejb.393.2021.07.15.12.31.34; Thu, 15 Jul 2021 12:31:57 -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=SecMYueb; 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 S1343761AbhGOTb4 (ORCPT + 99 others); Thu, 15 Jul 2021 15:31:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:45710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243773AbhGOTKE (ORCPT ); Thu, 15 Jul 2021 15:10:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 115726140A; Thu, 15 Jul 2021 19:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375991; bh=3J42CBELgmoeC8IW0L8kt4ewMtWxXKYKwnqbF9mZGDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SecMYuebWu7j8c9CI5ygGNIzLeiicTKe++thewtfVK6pEq96UBtkOVi+CF4bfuZo/ 8mMsndKd4xA5q2WK49irfElLKw5dWxVTtSLVTiDfkSd/jGLUhFGPpGtJjY3FcKp2zj oozyHBeA3E2yzcqPLKyNc/bmS4gVqlF0axoaVZpI= 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.13 081/266] net: moxa: Use devm_platform_get_and_ioremap_resource() Date: Thu, 15 Jul 2021 20:37:16 +0200 Message-Id: <20210715182628.497385195@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 b85733942053..5249b64f4fc5 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -481,13 +481,12 @@ 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)) { ret = PTR_ERR(priv->base); goto init_fail; } + ndev->base_addr = res->start; spin_lock_init(&priv->txlock); -- 2.30.2