Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1067400pxk; Fri, 18 Sep 2020 03:03:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr5g12xIYDYFLwTDRV0ug9if0kWm9hp3z0nYiBh/xAcSxEvulZl4uIj0IdzhhyHW2ZAPGh X-Received: by 2002:a17:906:d936:: with SMTP id rn22mr35491362ejb.4.1600423418816; Fri, 18 Sep 2020 03:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600423418; cv=none; d=google.com; s=arc-20160816; b=IyFRrD4ftHZuWgpOshV2Tc56QUIpY9ly35ZtSQXxaYzpVjBP1ZnGZpzSk00hC3yn5H kUUWBCuCpHioSdP0w/ZF/nyjbzAlw13jTEZDCOYUqxuYlhHL5Zxo5yh6xeeCjQ26zQ3O C4KCMsMohDrlWk4OoACLuIjXSXtNVscRwdoWFdYAdzrOLTlPug/+nfcBlpFkG95cIMfM s1xeSSFwnYNQlBqr3MifSIznp/cmxWLmAJiqFYk/eWs/yKz0Rnt4TsCn837NFNlNuCFM Zm1VtnqqOezCh+tSbVJ3MVUv6/DD4MkcVdVhsUjqZB3KmKXxEnGBQMh+2YdnDxGnTWyc nvGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=+VqS9gUEmlj/5K1Z96S8zAbSmEiQdZgcMJA89vsOkBc=; b=amdyeMplHFYLEE4jepcD6voxbFopfKr86GPDryZ9DjU+JQFsAAAhG1ZVcTifQ/1d4I OpZt7xHZi9xExIbK7RD6J2xgcAkzqBMh6dc0q0Yfnbm/8IcIRtA2ZBfpAFRD2xQmyWt4 28nTwXWLStpwnMStDDDUph3JrjTkxx7rBXXALesDV/znLkMSQjomnxGK8JuI5Cz70pU/ 6D8qnAbnVgKRTHOsGRpW23X44oSpdRQIMSY5ObkO0bfbBASlMKwNN2d/BrLopVweCcjY MWK7I90g8NUXwG1XcsiIvI26bZax0ALpzshIAgVJRAiT6ZhSe/ZxOwMYCMy2dHaenH+4 cMbw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si1683411eja.564.2020.09.18.03.03.06; Fri, 18 Sep 2020 03:03:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbgIRKB6 (ORCPT + 99 others); Fri, 18 Sep 2020 06:01:58 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51878 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726152AbgIRKB6 (ORCPT ); Fri, 18 Sep 2020 06:01:58 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C8F42C6C54B982B532C2; Fri, 18 Sep 2020 18:01:55 +0800 (CST) Received: from [10.65.58.147] (10.65.58.147) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Fri, 18 Sep 2020 18:01:46 +0800 Subject: Re: [PATCH -next] i2c: efm32: Use devm_platform_get_and_ioremap_resource() To: Wang ShaoBo References: <20200918082508.32427-1-bobo.shaobowang@huawei.com> CC: , , , , , , From: Yicong Yang Message-ID: <961c1feb-f818-f98c-f618-57c643bac04c@hisilicon.com> Date: Fri, 18 Sep 2020 18:01:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20200918082508.32427-1-bobo.shaobowang@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.65.58.147] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/9/18 16:25, Wang ShaoBo wrote: > Make use of devm_platform_get_and_ioremap_resource() provided by > driver core platform instead of duplicated analogue. dev_err() is > removed because it has been done in devm_ioremap_resource(). > > Signed-off-by: Wang ShaoBo > --- > drivers/i2c/busses/i2c-efm32.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c > index 838ce0947191..f6e13ceeb2b3 100644 > --- a/drivers/i2c/busses/i2c-efm32.c > +++ b/drivers/i2c/busses/i2c-efm32.c > @@ -332,21 +332,15 @@ static int efm32_i2c_probe(struct platform_device *pdev) > return ret; > } > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(&pdev->dev, "failed to determine base address\n"); > - return -ENODEV; > - } > + ddata->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); > + if (IS_ERR(ddata->base)) > + return PTR_ERR(ddata->base); > > if (resource_size(res) < 0x42) { res is not assigned. should it be removed? > dev_err(&pdev->dev, "memory resource too small\n"); > return -EINVAL; > } > > - ddata->base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(ddata->base)) > - return PTR_ERR(ddata->base); > - > ret = platform_get_irq(pdev, 0); > if (ret <= 0) { > if (!ret)