Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3513211pxb; Mon, 24 Jan 2022 11:07:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+KxXW56EpLLrZ1epswW5sH38vm35VJfWjcHrAD8tGdQk7g4AM0bZ/QyI3A2EsVwoQAI++ X-Received: by 2002:a65:6e90:: with SMTP id bm16mr9472208pgb.165.1643051264951; Mon, 24 Jan 2022 11:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051264; cv=none; d=google.com; s=arc-20160816; b=yrHFq1jLiWCipY/C4NTUw9UGfUVd+2hko/zTAskTz5ANOIY2kxlzmmHiT1078A1m2f z0DaLcGFySPg5BvynnBG8/bb2Bck5tSoTDathVe7WALCBdylSELg1o7xKk0Sjh1zvi9s seAL5KlDT7VNr1q/OYYHO2BfMo2xvo+y8nPpVxHtderBtoiFxzLXmtGlbdM75x01iRve Jo78IEDvpSmVB964IMvDK4CvBbZs5SlJ4D5jcPrgjyHzt6hfdVZgdgy+c+fzfJakHcYV uA1UG2sBLy5B3ISqzOlhlCbNZ7Ny9jR1KmXD400gwmeAdR0k9iW51fluX1SUAmUR0eoz Q47g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+wbW1q2Pnti9f7w1zuSyBi1OxRVfTMnMWRhRDCzvAgM=; b=y0ZIUGUNJoazxR44Cyp1Baa3tNIW3e25Vi37at1NZdViP07M9tY9KqY36mOPPjIpSb Ao8qhSp1xsFjthULhCcCTJnLk2a1XjBPOuolkefHr9sTIuBPl1xnYgS9fNmQDWAsZu2z uwbppdQ4C2iLPHgzuocz/SxHO9B2QZXjju+RnOz9XXRVBd8/2o4ar6H96KMzwX47RjEV mQoj6HxamWf7FTNAdrkZ9FYbEFSzOvxd7dWH3zhCqazu9pgtNmn/JB9jjqbQ7EmkoTWF 17HKoyC0w2mZV4r5LVKuUtktdr3hE1RrrUopsgoHGoPDjF0tF+RrOeboA/5rowCPciKl 0nOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=MXIzTOob; 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si149325pju.77.2022.01.24.11.07.25; Mon, 24 Jan 2022 11:07:44 -0800 (PST) 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=@collabora.com header.s=mail header.b=MXIzTOob; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238284AbiAXMJ2 (ORCPT + 99 others); Mon, 24 Jan 2022 07:09:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238247AbiAXMJ0 (ORCPT ); Mon, 24 Jan 2022 07:09:26 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC7AEC06173B; Mon, 24 Jan 2022 04:09:26 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id EED441F42E77 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643026165; bh=K2ObFY3Vsm+qnoFl2QeGq49BSilMuqWVDQ+bAXw3Mog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXIzTOobugUM0mowy79jjk1wphZsdQeaD09BgOWJkvg9YkRg2INPxE+3z59OGCbaP oGOgJZyLmJ/EDqaqCFR1peOp+C5HLSeEVSR8VN0fCVIerLlfa/PSP1gY89+4F7ymtk RmjpdpgsBEgOl0FqpJblVZj1Dsgw+lIhVOFigOX7JF8PmoIIh6/UCs+6NvySXOCRTo y5203U/mGV2mQ1spOsg1DoKw98o9G0kotfqk6RVIhRaDN8DxbfmdXuoyMl1P0n3i1d mZVoDugn6pJSvub6XGR1RYeiACs7trCsDaFVHFCgXjKt9Wq6pVhef28Ejy1BIlwamf GmUSTmUu1bXhg== From: AngeloGioacchino Del Regno To: bjorn.andersson@linaro.org Cc: mathieu.poirier@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, AngeloGioacchino Del Regno Subject: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible Date: Mon, 24 Jan 2022 13:09:15 +0100 Message-Id: <20220124120915.41292-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220124120915.41292-1-angelogioacchino.delregno@collabora.com> References: <20220124120915.41292-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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