* [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
@ 2025-12-18 9:06 Haoxiang Li
2025-12-19 10:17 ` Thomas Gleixner
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Haoxiang Li @ 2025-12-18 9:06 UTC (permalink / raw)
To: anna-maria, frederic, tglx; +Cc: linux-kernel, Haoxiang Li, stable
If device_register() fails, call put_device() to drop
the device reference.
Fixes: 501f867064e9 ("clockevents: Provide sysfs interface")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
kernel/time/clockevents.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index a59bc75ab7c5..94e223cf9c74 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -733,8 +733,12 @@ static __init int tick_broadcast_init_sysfs(void)
{
int err = device_register(&tick_bc_dev);
- if (!err)
- err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
+ if (err) {
+ put_deivce(&tick_bc_dev);
+ return err;
+ }
+
+ err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
return err;
}
#else
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
@ 2025-12-19 10:17 ` Thomas Gleixner
2025-12-19 13:28 ` Haoxiang Li
2025-12-20 14:59 ` kernel test robot
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2025-12-19 10:17 UTC (permalink / raw)
To: Haoxiang Li, anna-maria, frederic; +Cc: linux-kernel, Haoxiang Li, stable
On Thu, Dec 18 2025 at 17:06, Haoxiang Li wrote:
> If device_register() fails, call put_device() to drop
> the device reference.
>
> Fixes: 501f867064e9 ("clockevents: Provide sysfs interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> kernel/time/clockevents.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
> index a59bc75ab7c5..94e223cf9c74 100644
> --- a/kernel/time/clockevents.c
> +++ b/kernel/time/clockevents.c
> @@ -733,8 +733,12 @@ static __init int tick_broadcast_init_sysfs(void)
> {
> int err = device_register(&tick_bc_dev);
>
> - if (!err)
> - err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
> + if (err) {
> + put_deivce(&tick_bc_dev);
My brain compiler tells me that this was not even compiled. Try again.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-19 10:17 ` Thomas Gleixner
@ 2025-12-19 13:28 ` Haoxiang Li
0 siblings, 0 replies; 7+ messages in thread
From: Haoxiang Li @ 2025-12-19 13:28 UTC (permalink / raw)
To: tglx; +Cc: anna-maria, frederic, lihaoxiang, linux-kernel, stable
On Fri, 19 Dec 2025 11:17:27 +0100, Thomas Gleixner wrote:
>On Thu, Dec 18 2025 at 17:06, Haoxiang Li wrote:
> > If device_register() fails, call put_device() to drop
> > the device reference.
> >
> > Fixes: 501f867064e9 ("clockevents: Provide sysfs interface")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> > ---
> > kernel/time/clockevents.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
> > index a59bc75ab7c5..94e223cf9c74 100644
> > --- a/kernel/time/clockevents.c
> > +++ b/kernel/time/clockevents.c
> > @@ -733,8 +733,12 @@ static __init int tick_broadcast_init_sysfs(void)
> > {
> > int err = device_register(&tick_bc_dev);
> >
> > - if (!err)
> > - err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
> > + if (err) {
> > + put_deivce(&tick_bc_dev);
>
> My brain compiler tells me that this was not even compiled. Try again.
Sorry for my oversight. However, I found that tick_bc_dev is a static struct.
Is the error handling here pointless?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
2025-12-19 10:17 ` Thomas Gleixner
@ 2025-12-20 14:59 ` kernel test robot
2025-12-20 15:33 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-12-20 14:59 UTC (permalink / raw)
To: Haoxiang Li, anna-maria, frederic, tglx
Cc: oe-kbuild-all, linux-kernel, Haoxiang Li, stable
Hi Haoxiang,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on linus/master v6.19-rc1 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haoxiang-Li/clockevents-add-a-error-handling-in-tick_broadcast_init_sysfs/20251218-170931
base: tip/timers/core
patch link: https://lore.kernel.org/r/20251218090625.557965-1-lihaoxiang%40isrc.iscas.ac.cn
patch subject: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20251220/202512202122.Alirqoxm-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251220/202512202122.Alirqoxm-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512202122.Alirqoxm-lkp@intel.com/
All errors (new ones prefixed by >>):
kernel/time/clockevents.c: In function 'tick_broadcast_init_sysfs':
>> kernel/time/clockevents.c:737:17: error: implicit declaration of function 'put_deivce'; did you mean 'put_device'? [-Wimplicit-function-declaration]
737 | put_deivce(&tick_bc_dev);
| ^~~~~~~~~~
| put_device
vim +737 kernel/time/clockevents.c
731
732 static __init int tick_broadcast_init_sysfs(void)
733 {
734 int err = device_register(&tick_bc_dev);
735
736 if (err) {
> 737 put_deivce(&tick_bc_dev);
738 return err;
739 }
740
741 err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
742 return err;
743 }
744 #else
745 static struct tick_device *tick_get_tick_dev(struct device *dev)
746 {
747 return &per_cpu(tick_cpu_device, dev->id);
748 }
749 static inline int tick_broadcast_init_sysfs(void) { return 0; }
750 #endif
751
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
2025-12-19 10:17 ` Thomas Gleixner
2025-12-20 14:59 ` kernel test robot
@ 2025-12-20 15:33 ` kernel test robot
2025-12-20 21:34 ` kernel test robot
2025-12-22 6:24 ` kernel test robot
4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-12-20 15:33 UTC (permalink / raw)
To: Haoxiang Li, anna-maria, frederic, tglx
Cc: llvm, oe-kbuild-all, linux-kernel, Haoxiang Li, stable
Hi Haoxiang,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on linus/master v6.19-rc1 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haoxiang-Li/clockevents-add-a-error-handling-in-tick_broadcast_init_sysfs/20251218-170931
base: tip/timers/core
patch link: https://lore.kernel.org/r/20251218090625.557965-1-lihaoxiang%40isrc.iscas.ac.cn
patch subject: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20251220/202512202244.AR00sdAe-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251220/202512202244.AR00sdAe-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512202244.AR00sdAe-lkp@intel.com/
All errors (new ones prefixed by >>):
>> kernel/time/clockevents.c:737:3: error: call to undeclared function 'put_deivce'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
737 | put_deivce(&tick_bc_dev);
| ^
kernel/time/clockevents.c:737:3: note: did you mean 'put_device'?
include/linux/device.h:1162:6: note: 'put_device' declared here
1162 | void put_device(struct device *dev);
| ^
1 error generated.
vim +/put_deivce +737 kernel/time/clockevents.c
731
732 static __init int tick_broadcast_init_sysfs(void)
733 {
734 int err = device_register(&tick_bc_dev);
735
736 if (err) {
> 737 put_deivce(&tick_bc_dev);
738 return err;
739 }
740
741 err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
742 return err;
743 }
744 #else
745 static struct tick_device *tick_get_tick_dev(struct device *dev)
746 {
747 return &per_cpu(tick_cpu_device, dev->id);
748 }
749 static inline int tick_broadcast_init_sysfs(void) { return 0; }
750 #endif
751
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
` (2 preceding siblings ...)
2025-12-20 15:33 ` kernel test robot
@ 2025-12-20 21:34 ` kernel test robot
2025-12-22 6:24 ` kernel test robot
4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-12-20 21:34 UTC (permalink / raw)
To: Haoxiang Li, anna-maria, frederic, tglx
Cc: llvm, oe-kbuild-all, linux-kernel, Haoxiang Li, stable
Hi Haoxiang,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on linus/master v6.16-rc1 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haoxiang-Li/clockevents-add-a-error-handling-in-tick_broadcast_init_sysfs/20251218-170931
base: tip/timers/core
patch link: https://lore.kernel.org/r/20251218090625.557965-1-lihaoxiang%40isrc.iscas.ac.cn
patch subject: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20251220/202512202225.llvIQzJk-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251220/202512202225.llvIQzJk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512202225.llvIQzJk-lkp@intel.com/
All errors (new ones prefixed by >>):
>> kernel/time/clockevents.c:737:3: error: call to undeclared function 'put_deivce'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
737 | put_deivce(&tick_bc_dev);
| ^
kernel/time/clockevents.c:737:3: note: did you mean 'put_device'?
include/linux/device.h:1162:6: note: 'put_device' declared here
1162 | void put_device(struct device *dev);
| ^
1 error generated.
vim +/put_deivce +737 kernel/time/clockevents.c
731
732 static __init int tick_broadcast_init_sysfs(void)
733 {
734 int err = device_register(&tick_bc_dev);
735
736 if (err) {
> 737 put_deivce(&tick_bc_dev);
738 return err;
739 }
740
741 err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
742 return err;
743 }
744 #else
745 static struct tick_device *tick_get_tick_dev(struct device *dev)
746 {
747 return &per_cpu(tick_cpu_device, dev->id);
748 }
749 static inline int tick_broadcast_init_sysfs(void) { return 0; }
750 #endif
751
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
` (3 preceding siblings ...)
2025-12-20 21:34 ` kernel test robot
@ 2025-12-22 6:24 ` kernel test robot
4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-12-22 6:24 UTC (permalink / raw)
To: Haoxiang Li, anna-maria, frederic, tglx
Cc: oe-kbuild-all, linux-kernel, Haoxiang Li, stable
Hi Haoxiang,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on linus/master v6.19-rc2 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haoxiang-Li/clockevents-add-a-error-handling-in-tick_broadcast_init_sysfs/20251218-170931
base: tip/timers/core
patch link: https://lore.kernel.org/r/20251218090625.557965-1-lihaoxiang%40isrc.iscas.ac.cn
patch subject: [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs()
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20251222/202512220734.2gooRBi1-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251222/202512220734.2gooRBi1-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512220734.2gooRBi1-lkp@intel.com/
All errors (new ones prefixed by >>):
kernel/time/clockevents.c: In function 'tick_broadcast_init_sysfs':
>> kernel/time/clockevents.c:737:17: error: implicit declaration of function 'put_deivce'; did you mean 'put_device'? [-Wimplicit-function-declaration]
737 | put_deivce(&tick_bc_dev);
| ^~~~~~~~~~
| put_device
vim +737 kernel/time/clockevents.c
731
732 static __init int tick_broadcast_init_sysfs(void)
733 {
734 int err = device_register(&tick_bc_dev);
735
736 if (err) {
> 737 put_deivce(&tick_bc_dev);
738 return err;
739 }
740
741 err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
742 return err;
743 }
744 #else
745 static struct tick_device *tick_get_tick_dev(struct device *dev)
746 {
747 return &per_cpu(tick_cpu_device, dev->id);
748 }
749 static inline int tick_broadcast_init_sysfs(void) { return 0; }
750 #endif
751
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-22 6:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18 9:06 [PATCH] clockevents: add a error handling in tick_broadcast_init_sysfs() Haoxiang Li
2025-12-19 10:17 ` Thomas Gleixner
2025-12-19 13:28 ` Haoxiang Li
2025-12-20 14:59 ` kernel test robot
2025-12-20 15:33 ` kernel test robot
2025-12-20 21:34 ` kernel test robot
2025-12-22 6:24 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox