Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbdCAWxc (ORCPT ); Wed, 1 Mar 2017 17:53:32 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:64024 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447AbdCAWxN (ORCPT ); Wed, 1 Mar 2017 17:53:13 -0500 From: Arnd Bergmann To: Greg Kroah-Hartman Cc: Arnd Bergmann , Stephen Warren , Lee Jones , Eric Anholt , Daniel Stone , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Colin Ian King , popcornmix , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] staging/vc04_services: add CONFIG_OF dependency Date: Wed, 1 Mar 2017 23:50:19 +0100 Message-Id: <20170301225050.1298349-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170301225050.1298349-1-arnd@arndb.de> References: <20170301225050.1298349-1-arnd@arndb.de> X-Provags-ID: V03:K0:+cOOijhWcPupTR2Nsn0N7dnomEABYm9HcCGNHKo9OwN8vKR/pf8 i5aSoQawiirt4oRs5wNoWfwODi8vXQxyzdbm5AmDGjD2XFVr1wMwlt8A9T2Qjxon3kP7yee Bqb0AaZWMnNiC626EhzUadQMhBylCBgdlhDGInTiMMbZL/vLVWOm5AqTW1Ino+0wyWAfiYP 41ZN/HrJgUg4v4Vv9DHwA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Dr9wwmCb294=:cxUxVkIMOvpzBE9zqCv50I LsM+wqHZC/D8tss44pNHxOxLsrhHnExNIuJaq7fKRtUQSXX22Il03Po4TK2SIwKwU7W5rkBAW nGptg3bUdKPsF7CBMwZt8gFic5bqTDdG9wNEhAfCMWE2VAhvYtKaa2DgVF8iBEHjWWjmhToxc F57V3czItOI76X0PzsfPsTSKXZzkhkGjRhBBzxgobR5YKXpTw0TvsTlBxY6Ff7oe96c813Ea+ NWf4Uf2DNBbw0j+khoIrLvE3ffNVcHkA5jlVARc43Z11pDDR1wwQZtgEvHMME7aCMIxgJOxa8 PFRH552gHbcEN5e4Xlg5zucLtQAKSeTekV1l6uGwI9v+OmzeteRP0ovn6I0mdiNI0d0aZhspW fLIa1b3R2xjOx29rosRkovD5dn/TJ0UP2NuE+8nXR1pVO2ZnTqgNnP7QMmpzljqNY01vDA7gP Hp0te0GvR+K2h9T8xBOpaNahN/Vy1IoQd+4cB+V2xqaGyrOZ3fpY1tfrLuK3geZZKfBpML5lz 8VYJTaZELZCHJk1lo9O3UEFeFfxX2ZJuDVwCJfBT+hCKZe4XQ4I1xVdUOIT5UqHN0vfF4crRr pxN1t54/c824/PophRvNVmBLohelypIoOKysZNlYfRbrEWWdsepmAOfjjbi8Z878Z3v0cYaMZ FGqyLurbodWVC0sMENtQHA9FTcMzwIiwLPS8p43MC4j0gf514JJPTCZ1EuwKSC7ANI1Q= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2216 Lines: 56 After several hours of debugging this obviously bogus but elaborate gcc-7.0.1 warning, drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c: In function 'vchiq_complete_bulk': drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:603:4: error: argument 2 null where non-null expected [-Werror=nonnull] memcpy((char *)page_address(pages[0]) + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pagelist->offset, ~~~~~~~~~~~~~~~~~ fragments, ~~~~~~~~~~ head_bytes); ~~~~~~~~~~~ In file included from include/linux/string.h:18:0, from include/linux/bitmap.h:8, from include/linux/cpumask.h:11, from include/linux/interrupt.h:9, from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:37: arch/arm/include/asm/string.h:16:15: note: in a call to function 'memcpy' declared here extern void * memcpy(void *, const void *, __kernel_size_t) __nocapture(2); ^~~~~~ I have concluded that gcc was technically right in the first place: vchiq_complete_bulk is an externally visible function that calls free_pagelist(), which in turn derives a pointer from the global g_fragments_base variable. g_fragments_base is initialized in vchiq_platform_init(), but we only get there if of_property_read_u32() successfully reads the cache line size. When CONFIG_OF is disabled, this always fails, and g_fragments_base is guaranteed to be NULL when vchiq_complete_bulk() gets called. This adds a CONFIG_OF Kconfig dependency, which is also technically correct but nonobvious, and thus seems like a good fit for the warning. Signed-off-by: Arnd Bergmann --- drivers/staging/vc04_services/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig index e61e4ca064a8..74094fff4367 100644 --- a/drivers/staging/vc04_services/Kconfig +++ b/drivers/staging/vc04_services/Kconfig @@ -1,6 +1,7 @@ config BCM2835_VCHIQ tristate "Videocore VCHIQ" depends on HAS_DMA + depends on OF depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) default y help -- 2.9.0