Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/timer-mediatek: Fix "no-cfi indirect call" warning
@ 2026-11-01  9:55 Luca Leonardo Scorcia
  2026-11-01 22:40 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Leonardo Scorcia @ 2026-11-01  9:55 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Luca Leonardo Scorcia, kernel test robot, Nathan Chancellor,
	Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
	AngeloGioacchino Del Regno, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, linux-arm-kernel, llvm

After converting the driver to OF probing, kernel-test-robot reported the
following new warning:

vmlinux.o: warning: objtool: mtk_timer_probe+0x23: no-cfi indirect call!

This occurs because of_device_get_match_data() returns NULL when
CONFIG_OF is disabled, which results in LLVM dropping the kCFI setup
since it knows that there is no valid target for this call. Adding a
check for a NULL timer_init avoids the warning and it makes the probe
more robust since of_device_get_match_data() could return NULL even
when CONFIG_OF=y.

Fixes: 7a097aba7255 ("clocksource/drivers/timer-mediatek: Convert to OF probing")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610290223.iOEGeDs2-lkp@intel.com/
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
 drivers/clocksource/timer-mediatek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 842d6ee4259e..e772f5fe8742 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -353,6 +353,9 @@ static int mtk_timer_probe(struct platform_device *pdev)
 	int (*timer_init)(struct platform_device *pdev);
 
 	timer_init = of_device_get_match_data(&pdev->dev);
+	if (!timer_init)
+		return -ENODEV;
+
 	return timer_init(pdev);
 }
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clocksource/drivers/timer-mediatek: Fix "no-cfi indirect call" warning
  2026-11-01  9:55 [PATCH] clocksource/drivers/timer-mediatek: Fix "no-cfi indirect call" warning Luca Leonardo Scorcia
@ 2026-11-01 22:40 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2026-11-01 22:40 UTC (permalink / raw)
  To: Luca Leonardo Scorcia
  Cc: linux-mediatek, kernel test robot, Daniel Lezcano,
	Thomas Gleixner, Matthias Brugger, AngeloGioacchino Del Regno,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
	linux-arm-kernel, llvm

On Sun, Nov 01, 2026 at 10:55:31AM +0100, Luca Leonardo Scorcia wrote:
> After converting the driver to OF probing, kernel-test-robot reported the
> following new warning:
> 
> vmlinux.o: warning: objtool: mtk_timer_probe+0x23: no-cfi indirect call!
> 
> This occurs because of_device_get_match_data() returns NULL when
> CONFIG_OF is disabled, which results in LLVM dropping the kCFI setup
> since it knows that there is no valid target for this call. Adding a
> check for a NULL timer_init avoids the warning and it makes the probe
> more robust since of_device_get_match_data() could return NULL even
> when CONFIG_OF=y.
> 
> Fixes: 7a097aba7255 ("clocksource/drivers/timer-mediatek: Convert to OF probing")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202610290223.iOEGeDs2-lkp@intel.com/
> Suggested-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/clocksource/timer-mediatek.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
> index 842d6ee4259e..e772f5fe8742 100644
> --- a/drivers/clocksource/timer-mediatek.c
> +++ b/drivers/clocksource/timer-mediatek.c
> @@ -353,6 +353,9 @@ static int mtk_timer_probe(struct platform_device *pdev)
>  	int (*timer_init)(struct platform_device *pdev);
>  
>  	timer_init = of_device_get_match_data(&pdev->dev);
> +	if (!timer_init)
> +		return -ENODEV;
> +
>  	return timer_init(pdev);
>  }
>  
> -- 
> 2.43.0
> 

-- 
Cheers,
Nathan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-01 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01  9:55 [PATCH] clocksource/drivers/timer-mediatek: Fix "no-cfi indirect call" warning Luca Leonardo Scorcia
2026-11-01 22:40 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox