2023-04-03 04:38:14

by Dan Carpenter

[permalink] [raw]
Subject: drivers/clocksource/exynos_mct.c:635 mct_init_dt() warn: missing error code? 'ret'

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 00c7b5f4ddc5b346df62b757ec73f9357bb452af
commit: e8550f0e7bde9bd31697e3c534d386f7f3b5787b clocksource/drivers/exynos_mct: Support frc-shared property
config: arm64-randconfig-m041-20230329 (https://download.01.org/0day-ci/archive/20230402/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/clocksource/exynos_mct.c:635 mct_init_dt() warn: missing error code? 'ret'

vim +/ret +635 drivers/clocksource/exynos_mct.c

5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 613 static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
228e3023eb0430 drivers/clocksource/exynos_mct.c Arnd Bergmann 2013-04-09 614 {
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 615 bool frc_shared = of_property_read_bool(np, "samsung,frc-shared");
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 616 int ret;
36ba5d527e9567 arch/arm/mach-exynos/mct.c Thomas Abraham 2013-03-09 617
7cd925a8823d16 drivers/clocksource/exynos_mct.c Marek Szyprowski 2021-11-01 618 ret = exynos4_timer_resources(np);
7cd925a8823d16 drivers/clocksource/exynos_mct.c Marek Szyprowski 2021-11-01 619 if (ret)
7cd925a8823d16 drivers/clocksource/exynos_mct.c Marek Szyprowski 2021-11-01 620 return ret;
3a062281129229 arch/arm/mach-exynos4/mct.c Changhwan Youn 2011-10-04 621
7cd925a8823d16 drivers/clocksource/exynos_mct.c Marek Szyprowski 2021-11-01 622 ret = exynos4_timer_interrupts(np, int_type);
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 623 if (ret)
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 624 return ret;
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 625
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 626 ret = exynos4_clocksource_init(frc_shared);
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 627 if (ret)
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 628 return ret;
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 629
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 630 /*
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 631 * When the FRC is shared with a main processor, this secondary
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 632 * processor cannot use the global comparator.
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 633 */
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 634 if (frc_shared)
e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 @635 return ret;

This is zero, but it looks like it should be a negative. Changing this
to either "return 0;" or "return -EINVAL;" would clean up the ambiguity.

e8550f0e7bde9b drivers/clocksource/exynos_mct.c Vincent Whitchurch 2022-06-09 636
5e558ebd3d88d3 drivers/clocksource/exynos_mct.c Daniel Lezcano 2016-05-31 637 return exynos4_clockevent_init();
30d8bead5a3094 arch/arm/mach-exynos4/mct.c Changhwan Youn 2011-03-11 638 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests