Message ID | 20230929081637.2377335-1-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | coresight: etm4x: Remove bogous __exit annotation for some functions | expand |
On 29/09/2023 09:16, Uwe Kleine-König wrote: > etm4_platform_driver (which lives in ".data" contains a reference to > etm4_remove_platform_dev(). So the latter must not be marked with __exit > which results in the function being discarded for a build with > CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer > contain invalid data. > > etm4x_amba_driver referencing etm4_remove_amba() has the same issue. > > Drop the __exit annotations for the two affected functions and a third > one that is called by the other two. > Makes sense to me, I can't see any other struct platform_driver callbacks marked with __init or __exit. Reviewed-by: James Clark <james.clark@arm.com> > For reasons I don't understand this isn't catched by building with > CONFIG_DEBUG_SECTION_MISMATCH=y. > > Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") > Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > --- > drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 77b0271ce6eb..34aee59dd147 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -2224,7 +2224,7 @@ static void clear_etmdrvdata(void *info) > per_cpu(delayed_probe, cpu) = NULL; > } > > -static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) > +static void etm4_remove_dev(struct etmv4_drvdata *drvdata) > { > bool had_delayed_probe; > /* > @@ -2253,7 +2253,7 @@ static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) > } > } > > -static void __exit etm4_remove_amba(struct amba_device *adev) > +static void etm4_remove_amba(struct amba_device *adev) > { > struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); > > @@ -2261,7 +2261,7 @@ static void __exit etm4_remove_amba(struct amba_device *adev) > etm4_remove_dev(drvdata); > } > > -static int __exit etm4_remove_platform_dev(struct platform_device *pdev) > +static int etm4_remove_platform_dev(struct platform_device *pdev) > { > struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); > > > base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
On 29/09/2023 09:16, Uwe Kleine-König wrote: > etm4_platform_driver (which lives in ".data" contains a reference to > etm4_remove_platform_dev(). So the latter must not be marked with __exit > which results in the function being discarded for a build with > CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer > contain invalid data. > > etm4x_amba_driver referencing etm4_remove_amba() has the same issue. > > Drop the __exit annotations for the two affected functions and a third > one that is called by the other two. > > For reasons I don't understand this isn't catched by building with > CONFIG_DEBUG_SECTION_MISMATCH=y. > > Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") > Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Thanks for the fix, I can queue them via the coresight tree. Suzuki
On 02/10/2023 10:44, Suzuki K Poulose wrote: > On 29/09/2023 09:16, Uwe Kleine-König wrote: >> etm4_platform_driver (which lives in ".data" contains a reference to >> etm4_remove_platform_dev(). So the latter must not be marked with __exit >> which results in the function being discarded for a build with >> CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer >> contain invalid data. >> >> etm4x_amba_driver referencing etm4_remove_amba() has the same issue. >> >> Drop the __exit annotations for the two affected functions and a third >> one that is called by the other two. >> >> For reasons I don't understand this isn't catched by building with >> CONFIG_DEBUG_SECTION_MISMATCH=y. >> >> Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") >> Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only >> devices") >> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > Thanks for the fix, I can queue them via the coresight tree. I have queued this for next: https://git.kernel.org/coresight/c/aca46e6f0350 Suzuki > > Suzuki > > > _______________________________________________ > CoreSight mailing list -- coresight@lists.linaro.org > To unsubscribe send an email to coresight-leave@lists.linaro.org
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 77b0271ce6eb..34aee59dd147 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2224,7 +2224,7 @@ static void clear_etmdrvdata(void *info) per_cpu(delayed_probe, cpu) = NULL; } -static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) +static void etm4_remove_dev(struct etmv4_drvdata *drvdata) { bool had_delayed_probe; /* @@ -2253,7 +2253,7 @@ static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) } } -static void __exit etm4_remove_amba(struct amba_device *adev) +static void etm4_remove_amba(struct amba_device *adev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); @@ -2261,7 +2261,7 @@ static void __exit etm4_remove_amba(struct amba_device *adev) etm4_remove_dev(drvdata); } -static int __exit etm4_remove_platform_dev(struct platform_device *pdev) +static int etm4_remove_platform_dev(struct platform_device *pdev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
etm4_platform_driver (which lives in ".data" contains a reference to etm4_remove_platform_dev(). So the latter must not be marked with __exit which results in the function being discarded for a build with CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer contain invalid data. etm4x_amba_driver referencing etm4_remove_amba() has the same issue. Drop the __exit annotations for the two affected functions and a third one that is called by the other two. For reasons I don't understand this isn't catched by building with CONFIG_DEBUG_SECTION_MISMATCH=y. Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d