From 23fdd53d97ff491d2dc17fda78fb22cd6825623d Mon Sep 17 00:00:00 2001 From: jiamin ma Date: Wed, 18 Apr 2018 08:37:52 +0800 Subject: [PATCH] defect: fix section mismatch warning PD#164617: section mismatch warning When a variable or function with __initxxx anotation refers a variable or function without it, there will be a section mismatch warning. In such case, memory belong to the latter will be released after kernel booting up, if the former still refers the latter, strange things happens So we have to use __initxxx anotations correctly or add __refxxx anotations to teach modpost that it is okay and save to use __init anotations in this way. Change-Id: Ic97dac8998b2a01c82dd7a3bae12fa9c7a113bc4 Signed-off-by: jiamin ma --- drivers/amlogic/clk/clkc.h | 2 +- drivers/amlogic/ddr_tool/ddr_bandwidth.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/clk/clkc.h b/drivers/amlogic/clk/clkc.h index 72dec81187cb..f83706568784 100644 --- a/drivers/amlogic/clk/clkc.h +++ b/drivers/amlogic/clk/clkc.h @@ -33,7 +33,7 @@ #define MESON_PARM_APPLICABLE(p) (!!((p)->width)) #define PNAME(x) \ -static const char *x[] __initconst +static const char *x[] struct parm { u16 reg_off; diff --git a/drivers/amlogic/ddr_tool/ddr_bandwidth.c b/drivers/amlogic/ddr_tool/ddr_bandwidth.c index 8b8f9d7ca352..002c6fa92cb1 100644 --- a/drivers/amlogic/ddr_tool/ddr_bandwidth.c +++ b/drivers/amlogic/ddr_tool/ddr_bandwidth.c @@ -241,7 +241,12 @@ static struct class aml_ddr_class = { .class_attrs = aml_ddr_tool_attr, }; -static int ddr_bandwidth_probe(struct platform_device *pdev) +/* + * ddr_bandwidth_probe only executes before the init process starts + * to run, so add __ref to indicate it is okay to call __init function + * ddr_find_port_desc + */ +static int __ref ddr_bandwidth_probe(struct platform_device *pdev) { int r = 0; #ifdef CONFIG_OF