Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp652178pxv; Thu, 15 Jul 2021 12:31:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxiqJiS9d7nCVj3WPR+hnKkkfobe4Zs8BcyLLcaSTtKR5QLHjPJqfDtLN5FDGL5Py3bkiU X-Received: by 2002:aa7:dc42:: with SMTP id g2mr9063900edu.362.1626377493497; Thu, 15 Jul 2021 12:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377493; cv=none; d=google.com; s=arc-20160816; b=oVry3PevIJf0ToVpgUThn0IqwYU7jU38YqnSOCZSRiSeQynOBHEjlzTG+j9Ria+75F KBOFsP0RpGw37TAx1fCCh9FjUM2FFsycppQQWVZuqbNKUnRennZxdeM5Bry5YJDEntHx FD0/1fz8pRAPfD5mVeCRFv7ES5MC+XDXIigzpYtzoiWaJVSZHckpCrik5tDd8HxQQnn4 JvZe2iWQLmpHcFEiNA0bkZcnPWs9SStnf2eTDYN/kqWkjIoj+qMUo6idMs1bvqfx54tP l6YKKeE7oKKG8yB122wifdCFp1M0pEMk87k5fZm6TNdD4nkpQHE1WC/6WB1qAVFn3u1i i7GA== 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=J+CnaUTPHdkqEVY19wIZ1nklgOj6qmD8Ag8xRlm4k9I=; b=VJwDeQSCU7qV99Apu3B/AH0RveSJujDicp7iRxQk7Hj6NMq5//lUdZ4Tu0UhJv95Ve wBzvZKRv87rV5TtRKoMZXp8S/AW5F1asu43f4GELbc2cX5kcanFky8ovNbIB31tKkhqr s5y1ET7TQk9td41MBrGKtp1oUa8iKQfn1e45J1QxqWTxeLg2yo3SEl0E3dHtoYAR+pJm zUKCdY2Garw+f3aKymFcPeInD3TOn0mWkYJY9UGIQGJ86DZEh4Ai+wB4LCXKjINJIndb P/Kn89mKaJjgZCq4aljDdtTiq6rlPh+cgX0xtL7G/Rzemj8jofsGni4vZgUHTXOnCbWY 4TqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F93gk/Pc"; 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 gt34si8259583ejc.285.2021.07.15.12.31.10; Thu, 15 Jul 2021 12:31:33 -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="F93gk/Pc"; 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 S1344247AbhGOT3m (ORCPT + 99 others); Thu, 15 Jul 2021 15:29:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243871AbhGOTKL (ORCPT ); Thu, 15 Jul 2021 15:10:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0EF561370; Thu, 15 Jul 2021 19:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376024; bh=OUttnZfZ2XueT8ypLeni7GSulhpsz4hmA/8lKqb26xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F93gk/Pc/92n22Ydj+96OTcPh+kxwuTWMh+8wagzahtXJKFE9L7nFhFDaZlVAfwbr wxxs9Y6N1oWvg8dtpyejQZLFfseu0AFPxxkMV3m5VeCeb06xoEvGNRy/kwZKukc+5e cStzU8XACIjsoaKpyoBqtLNT/EyPuz6UoCU64bRo= 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 094/266] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource() Date: Thu, 15 Jul 2021 20:37:29 +0200 Message-Id: <20210715182630.712084685@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 8a55a73433e763c8aec4a3e8df5c28c821fc44b9 ] 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/mdio/mdio-mux-bcm-iproc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c b/drivers/net/mdio/mdio-mux-bcm-iproc.c index 03261e6b9ceb..aa29d6bdbdf2 100644 --- a/drivers/net/mdio/mdio-mux-bcm-iproc.c +++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c @@ -187,7 +187,9 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev) return -ENOMEM; md->dev = &pdev->dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(md->base)) + return PTR_ERR(md->base); if (res->start & 0xfff) { /* For backward compatibility in case the * base address is specified with an offset. @@ -196,9 +198,6 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev) res->start &= ~0xfff; res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1; } - md->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(md->base)) - return PTR_ERR(md->base); md->mii_bus = devm_mdiobus_alloc(&pdev->dev); if (!md->mii_bus) { -- 2.30.2