Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4836697pxb; Sun, 6 Feb 2022 05:09:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbmFnFITneXQt++LTS3k5rJ4Vp1XaaDr0lA6nXdh0oOVLY5AAoIzFjuAzxjI/0rktechga X-Received: by 2002:aa7:dd15:: with SMTP id i21mr5863542edv.198.1644152967795; Sun, 06 Feb 2022 05:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644152967; cv=none; d=google.com; s=arc-20160816; b=UG6pMsr6ljJ0d2lCXeo5a1UB6VM84EeNxh5gz+0pAA6/Oh2RSZHWLUkEf1UxCsfaSy IYBJkSpnav9vCH1MZ9Vj3xGzRzg9A0TPSK3zazFK4m+FQBAlQDu7qIjHeEXwxYcHTCBJ m8rhMqMCH8JDzdOihuPMXAL8ERFRGRTCQi3goSdOwaWG2bT+gCwpfCGobxnE7uvjy6CE UTYgCkoMLxkhrBOi6YKFJq88HCy7h+SVDUWeptcymGZUWDCTQ+pkqmYN4XjWsCS1qfUL +xFJVVbCNGjJItCQPmcznLl46mef8gkiRXxSwcRqKdPOPXFEWyPJ/M09x4UpKbWCld39 cd+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4UCJ1jUJ4zsq4RQrX6k+nXy4mHY8saVQioi5/XKVhkU=; b=SgrGSckR3U5XF6wQLzXO6XwoOPF8C/TD5eknPgkIItngREZQphkBO8PlfH+D/DgodW EmF5YwMaCoYlfEYuqypPkSPkT1iL2Zs71ca/z0tsj4eLbduHd4+iBn2qzxODuc7WyrhB +UaGtLqWrDDC0eyJPap9VR5p+YbOuWHsqsdeKjDkpOf4kO+qLDkkdFMj4YModXlwCoJl Cekd4LZOXmCoVC0P/6jAGdhAFcOq/7siRhSdgSbXDosOGydO1FdZwB6AUTWUoL+rx376 F3l7Tly2X1yUxwS3q1lU+vjAVnwTNWjTzzn5UZ8DnL0Hbjne6vkfNyJFqauM/l7ugED0 iJ6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LLr8ELYv; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8si5323764ejv.536.2022.02.06.05.09.02; Sun, 06 Feb 2022 05:09:27 -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=@linaro.org header.s=google header.b=LLr8ELYv; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346368AbiBBRxd (ORCPT + 99 others); Wed, 2 Feb 2022 12:53:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238285AbiBBRxc (ORCPT ); Wed, 2 Feb 2022 12:53:32 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5587C061714 for ; Wed, 2 Feb 2022 09:53:31 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id r10so292084edt.1 for ; Wed, 02 Feb 2022 09:53:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4UCJ1jUJ4zsq4RQrX6k+nXy4mHY8saVQioi5/XKVhkU=; b=LLr8ELYvbwUDr+aWKlSrG7aUEVXyzH50uh6oKTFF7ifbs0kTp+dePMb7OIOs/lJCtT qaJ8Z+yD1zBb3jPMgX+hcXZn8jnlqb+ScSFNJo0JtmS9p6QniJMseacEDgSDBtBsKBOU ZWAbLXI5JASZmkTiW0hegjZXUDbom39pQhwENiJcJAYXfMFJnASas543LR60wciqH+9t KobLEDbuFSmwRUoucGbr3iNZgHslL2pv1YGuXfqU3aUmB8ZtAG/av0CWvJzxEdGyFJng nefKqmCJBXsKClb/eskETv9fJXR90QdKQcDMyV0Dau4hVNITUOA4BtMNF9NCaZlxSzai jh4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4UCJ1jUJ4zsq4RQrX6k+nXy4mHY8saVQioi5/XKVhkU=; b=VmSTFvaeZhvVHnC5E/DjmBIEtmBoNp65WxafnrjbNny7ulS9+g97O/7eZSCjkjQSze aeWRpX8lBH+HeN1ktfaPYkTVXXDKR9d9doBWJ86AqT8gzX2u4ijmr9JOAfyJuA3t+tHP RaSWo+2HdLXk1+Pr7FwzOgVL39rj02sdX3nFRQu0Co3HT2F9FuZZOMQoqS2GxIaGdXHe VvJaBz69dbbLSrqRPj4bti3HoewaVB5nAeOeNZNCzBWr/ubvKq5IlqIH2u0SeG8IA0kA 8WZhMSuXulSGGUizvFJfBHUa6qNrafQpcm4L0YRzGHQsgBVa6/dioh4Zt6fVZw1VF2in MWYg== X-Gm-Message-State: AOAM531+1J5Fm4tc33ibiOAx2XwfBofEFQDrrxrn2FMgsV1Owq/XvENo ABmg/nRRUCr16hn4nYYlXOUQhGixBUuKKqDRsWNzwg== X-Received: by 2002:a05:6402:1c95:: with SMTP id cy21mr31387969edb.170.1643824410275; Wed, 02 Feb 2022 09:53:30 -0800 (PST) MIME-Version: 1.0 References: <20220124120915.41292-1-angelogioacchino.delregno@collabora.com> <20220124120915.41292-3-angelogioacchino.delregno@collabora.com> <20220201183612.GC2490199@p14s> <91fff43a-c85d-2934-b54b-67ffe6fc2f29@collabora.com> In-Reply-To: <91fff43a-c85d-2934-b54b-67ffe6fc2f29@collabora.com> From: Mathieu Poirier Date: Wed, 2 Feb 2022 10:53:17 -0700 Message-ID: Subject: Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible To: AngeloGioacchino Del Regno 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Feb 2022 at 02:03, AngeloGioacchino Del Regno wrote: > > 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. I have applied all 3 patches. > > 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