Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1711201pxb; Wed, 2 Feb 2022 10:45:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzk1gAxUobpC1rjQH0/NspDuo96uyu+/mYHUqk4gBoFtlJ7H+D95XLi0dKU4Osl2gM+XQE4 X-Received: by 2002:a17:903:120d:: with SMTP id l13mr31616171plh.120.1643827548357; Wed, 02 Feb 2022 10:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643827548; cv=none; d=google.com; s=arc-20160816; b=aB8Q1ZUH5Pw2NSgrznQUXJfv5ERMScxz9gBxkfTqbNkk1sAu7DGfmsfEBOJGtHplE3 +mhiF3eY+BRluOrFhhpbiVWvTN7ordidgaN64AIg2fU18b1VtKTp+XW5Y9tOBEByul1G sjsFl//qbcAErHuVq8QTv8Mqvapyeo+uPH/HK3RAKcu2DlDvbQVtE/Dwqj/fyFd0xEgm J9wE1ihiZ5G+5OL7RjavPxUijpR69NokzvT/rX5g7xdxjAT9yDGdNcj2Z3BviaAuGOsP rgS6oQTTOAnvvEVMyjji0eVAHhYZHJS5QhI/bxpGSVL1jzFXKuGtSVy5Lfv7PQMOkvH7 mT+A== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IssHr4mA5OGavf9b/znnTZs44hT6Thk5GtIWwHbxtHw=; b=mxAq0XedSShfuWW7AzsffU71//3a774jtGdRWGSdMfDkrlWA9FcT91mecrGju3qwuW HJQqxgbBWytHaOx+HalwkKP42rNFYBqWRK9rE+scbAsRVDjbGhUomTMMK9n3T29FXHZz YwMV3vpMNncqgbybhni4CvvXuS5713icazXadTtCZHCz30n+ZB25EUdxDo0ujQDEPFBS dsGlhFDXbrD4fEF0BKejoAhyd++wS/2090I7FLXi/wMzHZyBJqGatEVrQkuU5wztxH4P A7HFX69MCEi9Da8MsZjkomBZj5jGMzhb4EKWNij49xR5IflYanfs5k/fs8JrkGenZUf9 +Cog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=b1RRKral; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13si17613622pfe.380.2022.02.02.10.45.33; Wed, 02 Feb 2022 10:45:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=b1RRKral; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245000AbiBBJDj (ORCPT + 99 others); Wed, 2 Feb 2022 04:03:39 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54584 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237719AbiBBJDi (ORCPT ); Wed, 2 Feb 2022 04:03:38 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id C0FAC1F44279 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643792617; bh=ViQMSZyem2MB0mucYiFAcZf2AlB+Sx22LpjdHO5YXF0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=b1RRKral5pgotlT6/jsPB+u1VgcTZt1FRG7f2Er6wgkECZsykAIVxS2Nun0z4mTeo q/7Kkirv9qIpyJBbD/SOYgFQifaE/65xIkE09at9DlJO/IoM6q+S59z6BrWr7JhhgF EiuW2pLioSCLXtKvwlYFbQbohL8u5aa58DrXHDoBacOP0c6ipDEKOTYd+L1KUi10OA xRkwKskoXoTGTe1YmhFRaarO1tH/wPe3DeLIT4KEwx7RP2FU0wNGyHHROw7Phf3erO buErqVINDQhsx9hyD8w9sJrRd7WnkDUZQKtHJrhWNwLr9NO+3VxKGzxm4qq1tvJr4n 0w9chva8H2eLw== Message-ID: <91fff43a-c85d-2934-b54b-67ffe6fc2f29@collabora.com> Date: Wed, 2 Feb 2022 10:03:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible Content-Language: en-US To: Mathieu Poirier Cc: bjorn.andersson@linaro.org, matthias.bgg@gmail.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com References: <20220124120915.41292-1-angelogioacchino.delregno@collabora.com> <20220124120915.41292-3-angelogioacchino.delregno@collabora.com> <20220201183612.GC2490199@p14s> From: AngeloGioacchino Del Regno In-Reply-To: <20220201183612.GC2490199@p14s> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 01/02/22 19:36, Mathieu Poirier ha scritto: > Hi Angelo, > > On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote: >> Simplify the probe function, where possible, by using dev_err_probe(). >> While at it, as to increase human readability, also remove some >> unnecessary forced void pointer casts that were previously used in >> error checking. > > I am in favour of all 3 patches (please add a cover letter next time) but weary > about testing - do you have access to a Mediatek platform to try this on or > is it purely theoretical? > > I would definitely feel better to see a "Tested-by" tag by someone out there > with access to the HW. > > Thanks, > Mathieu > Hello Mathieu, I have multiple MediaTek platforms and I always test on all of them before pushing such commits upstream, so, even though this kind of patch is trivial, this is *not* purely theoretical and I confirm that this was successfully tested. Regards, Angelo >> >> Signed-off-by: AngeloGioacchino Del Regno >> --- >> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++---------------- >> 1 file changed, 12 insertions(+), 16 deletions(-) >> >> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c >> index e40706b0e015..dcddb33e9997 100644 >> --- a/drivers/remoteproc/mtk_scp.c >> +++ b/drivers/remoteproc/mtk_scp.c >> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev) >> int ret, i; >> >> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp)); >> - if (!rproc) { >> - dev_err(dev, "unable to allocate remoteproc\n"); >> - return -ENOMEM; >> - } >> + if (!rproc) >> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n"); >> >> scp = (struct mtk_scp *)rproc->priv; >> scp->rproc = rproc; >> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev) >> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram"); >> scp->sram_base = devm_ioremap_resource(dev, res); >> - if (IS_ERR((__force void *)scp->sram_base)) { >> - dev_err(dev, "Failed to parse and map sram memory\n"); >> - return PTR_ERR((__force void *)scp->sram_base); >> - } >> + if (IS_ERR(scp->sram_base)) >> + return dev_err_probe(dev, PTR_ERR(scp->sram_base), >> + "Failed to parse and map sram memory\n"); >> + >> scp->sram_size = resource_size(res); >> scp->sram_phys = res->start; >> >> /* l1tcm is an optional memory region */ >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); >> scp->l1tcm_base = devm_ioremap_resource(dev, res); >> - if (IS_ERR((__force void *)scp->l1tcm_base)) { >> - ret = PTR_ERR((__force void *)scp->l1tcm_base); >> + if (IS_ERR(scp->l1tcm_base)) { >> + ret = PTR_ERR(scp->l1tcm_base); >> if (ret != -EINVAL) { >> - dev_err(dev, "Failed to map l1tcm memory\n"); >> - return ret; >> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); >> } >> } else { >> scp->l1tcm_size = resource_size(res); >> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev) >> } >> >> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg"); >> - if (IS_ERR((__force void *)scp->reg_base)) { >> - dev_err(dev, "Failed to parse and map cfg memory\n"); >> - return PTR_ERR((__force void *)scp->reg_base); >> - } >> + if (IS_ERR(scp->reg_base)) >> + return dev_err_probe(dev, PTR_ERR(scp->reg_base), >> + "Failed to parse and map cfg memory\n"); >> >> ret = scp->data->scp_clk_get(scp); >> if (ret) >> -- >> 2.33.1 >> -- AngeloGioacchino Del Regno Software Engineer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718