Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ccp - Remove forward declaration

Clang emits a warning about this construct:

drivers/crypto/ccp/sp-platform.c:36:36: warning: tentative array
definition assumed to have one element
static const struct acpi_device_id sp_acpi_match[];
^
1 warning generated.

Just remove the forward declarations and move the initializations up
so that they can be used in sp_get_of_version and sp_get_acpi_version.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Nathan Chancellor and committed by
Herbert Xu
3512dcb4 944585a6

+25 -28
+25 -28
drivers/crypto/ccp/sp-platform.c
··· 33 33 unsigned int irq_count; 34 34 }; 35 35 36 - static const struct acpi_device_id sp_acpi_match[]; 37 - static const struct of_device_id sp_of_match[]; 36 + static const struct sp_dev_vdata dev_vdata[] = { 37 + { 38 + .bar = 0, 39 + #ifdef CONFIG_CRYPTO_DEV_SP_CCP 40 + .ccp_vdata = &ccpv3_platform, 41 + #endif 42 + }, 43 + }; 44 + 45 + #ifdef CONFIG_ACPI 46 + static const struct acpi_device_id sp_acpi_match[] = { 47 + { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, 48 + { }, 49 + }; 50 + MODULE_DEVICE_TABLE(acpi, sp_acpi_match); 51 + #endif 52 + 53 + #ifdef CONFIG_OF 54 + static const struct of_device_id sp_of_match[] = { 55 + { .compatible = "amd,ccp-seattle-v1a", 56 + .data = (const void *)&dev_vdata[0] }, 57 + { }, 58 + }; 59 + MODULE_DEVICE_TABLE(of, sp_of_match); 60 + #endif 38 61 39 62 static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) 40 63 { ··· 222 199 223 200 return sp_resume(sp); 224 201 } 225 - #endif 226 - 227 - static const struct sp_dev_vdata dev_vdata[] = { 228 - { 229 - .bar = 0, 230 - #ifdef CONFIG_CRYPTO_DEV_SP_CCP 231 - .ccp_vdata = &ccpv3_platform, 232 - #endif 233 - }, 234 - }; 235 - 236 - #ifdef CONFIG_ACPI 237 - static const struct acpi_device_id sp_acpi_match[] = { 238 - { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, 239 - { }, 240 - }; 241 - MODULE_DEVICE_TABLE(acpi, sp_acpi_match); 242 - #endif 243 - 244 - #ifdef CONFIG_OF 245 - static const struct of_device_id sp_of_match[] = { 246 - { .compatible = "amd,ccp-seattle-v1a", 247 - .data = (const void *)&dev_vdata[0] }, 248 - { }, 249 - }; 250 - MODULE_DEVICE_TABLE(of, sp_of_match); 251 202 #endif 252 203 253 204 static struct platform_driver sp_platform_driver = {