From patchwork Tue May 16 20:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13243857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CC62C77B7F for ; Tue, 16 May 2023 20:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8wS4VNl/5U/tE7k+bgtjUHS5EAjECIaBbI+GZw7IA4Q=; b=jnQbcvEEib207J bRNFBCK/WgfzMzlaQmslsKmfJrDrVtMOjfK5dy7G+Yvmeo0osjlMVSjy/+mn71nHkBvp0SMvgm2n4 dtguAlYrZo5LTDeMqz7eF1tEk1cvqjFLOjFdpazkE2Kq4YUF751vm9dIPwV4MewGrxaadNKUoy7+t jVGV93B2fjeB3KRYinAuYPsdu+f0NPrRzY31PjRfVtEujNmmB3o/lLYjgV9uzTjdolWeE32A/Bau6 CKBDhcLw1mzrmeq8fMAJInqNbGyWcOWQmzcvAVG0MBe4+JQZOn3SMRuyMhya1oW/7Nk2wpFg/bUm7 ms8fTaXZKOimkWhhNhtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pz1FN-0073FK-1L; Tue, 16 May 2023 20:26:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pz1FK-0073EZ-23; Tue, 16 May 2023 20:26:12 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FEF86301B; Tue, 16 May 2023 20:26:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1707C433EF; Tue, 16 May 2023 20:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684268769; bh=DGi4eUWzPXy8Fa8N7P2ArAP2jVc3TCXs+v8ySrraZgA=; h=From:To:Cc:Subject:Date:From; b=AEVTnF6C2ACn2TfkYqOFHyR/RMkD8WW54QwQYAlXhgQX38M7pnjLIX/9jrkXUdCOD A34gXpgBUrVktk6QgU80CMsNHMhyeWJ6MTXRlmrg/I9T+Q4GjRtnI6d5qGbd39ZaC3 csFj+bqmSM9h2MJvJi5uaW5mrZDNxYwK580vUWQC1mfyKXeih+dokFpfIMcqz3ch6A erBTAAp/fEvMygNth8dp4XK2h36r5rMB6jflB50joDra/mwKOsCJYPya5NXDVE+bXS qK/CwbUPXzeEFErZyy7z3oeTD4KwIWxJ6ey6e1oNSau/sVc/VnSwKLafo0n96sQ8g9 4NTXKHhuwDqHQ== From: Arnd Bergmann To: Florian Fainelli , Greg Kroah-Hartman , Stefan Wahren Cc: Arnd Bergmann , Broadcom internal kernel review list , Umang Jain , Adrien Thierry , Phil Elwell , Peter Zijlstra , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: vchiq_arm: mark vchiq_platform_init() static Date: Tue, 16 May 2023 22:25:55 +0200 Message-Id: <20230516202603.560554-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_132610_753178_87F3C16F X-CRM114-Status: GOOD ( 17.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann This function has no callers from other files, and the declaration was removed a while ago, causing a W=1 warning: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:465:5: error: no previous prototype for 'vchiq_platform_init' Marking it static solves this problem but introduces a new warning since gcc determines that 'g_fragments_base' is never initialized in some kernel configurations: In file included from include/linux/string.h:254, from include/linux/bitmap.h:11, from include/linux/cpumask.h:12, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:8: In function 'memcpy_to_page', inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:433:4: include/linux/fortify-string.h:57:33: error: argument 2 null where non-null expected [-Werror=nonnull] include/linux/highmem.h:427:9: note: in expansion of macro 'memcpy' 427 | memcpy(to + offset, from, len); | ^~~~~~ Add a NULL pointer check for this in addition to the static annotation to avoid both. Fixes: 89cc4218f640 ("staging: vchiq_arm: drop unnecessary declarations") Signed-off-by: Arnd Bergmann Reviewed-by: Florian Fainelli Reviewed-by: Umang Jain --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 90a3958d1f29..aa2313f3bcab 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -415,7 +415,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel pagelistinfo->scatterlist_mapped = 0; /* Deal with any partial cache lines (fragments) */ - if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS && g_fragments_base) { char *fragments = g_fragments_base + (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * g_fragments_size; @@ -462,7 +462,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel cleanup_pagelistinfo(instance, pagelistinfo); } -int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state) +static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state) { struct device *dev = &pdev->dev; struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);