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: 94933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp684075vqo; Tue, 16 May 2023 13:31:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68bJUPA1NaoC3mcWNBJ6NkFR0EmikP1pl6Jj5OooPYj+N1ajcfMj3Jh+MuGiDXXSTW7+AO X-Received: by 2002:a17:903:234f:b0:1ae:bf5:7b5 with SMTP id c15-20020a170903234f00b001ae0bf507b5mr11926333plh.34.1684269068129; Tue, 16 May 2023 13:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684269068; cv=none; d=google.com; s=arc-20160816; b=Snvt+G39zQBFHGFu8CwsHZ1Ua4EtyMoDx8pbnVfSUYln2Bf1vQGETz5oyyGtqxfNq6 vD8Bqwmb7sLRSCtz+Tc+PXI4Cvrh0plekDJ1IhqKRaGLqTjNypvi64bvJCoVPGd4ZaQ5 T1jURsITBDrTGjSXNWTL5Rl9i1+RtE/kIZvqXjeJl+LyXsFyZxvea5oOSsS07Yom7p27 22wMaotvLudch1oEnVQzaCUEQemOZV5D5vDZvdTCnFyZLlWBzRpnYOCk2CUzo3sGT9/Q UC1huVvlweNEgKuBVwacuHLQsxOLjVvYbOvW2CAsUR3fxUlZRDnAmgVeOewFyDa7aZhd dJ5g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=e5346RdME1fPWzyWPlFxmGNl/8XXpGdLTU9gXz/3yNU=; b=GCDLTS0F8xSXu/+Q9pHju2a/5XJYemphY7y1NO1S3zmNAC4+qz0hgWrN4HebXd4aFY uIJ0Fcl5fkNWiDr+gZlfN0oZ/mKlJxBEdcmGMq1ao9bKYBSI0FAhT1XqPu+opcL9lnQi mUZWde4xhuRM5xYf8bgMqJgFCBMruDGisn9ioAGkgo4Vyf8G7c3gma+BprN/9BZPMkU/ A/zfuEOC21hBPPQ4qP/iGzAFf+Iw9GZJXU+4WCLWc2BvqzrpIon81687kjHpYFwPY2Hj 1mLvjqN70wE73GjxtQ71h4rhheyQiDF/xPSal6kSoLPZCynY+sHUMqmx3+ilhL3i5q2p BhQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AEVTnF6C; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a170903124a00b001adb600d5e9si16952779plh.640.2023.05.16.13.30.52; Tue, 16 May 2023 13:31:08 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=AEVTnF6C; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229458AbjEPU0z (ORCPT + 99 others); Tue, 16 May 2023 16:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjEPU0y (ORCPT ); Tue, 16 May 2023 16:26:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67851D04B for ; Tue, 16 May 2023 13:26:15 -0700 (PDT) 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 32B14638F9 for ; 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766084122467621395?= X-GMAIL-MSGID: =?utf-8?q?1766084122467621395?= 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);