Skip to contentSkip to conversation

drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection

PATCH In review kernel test robot 4 participants 8 messages Nov 22, 2025 – Nov 25, 2025

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
date:   8 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/[email protected]/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/20251122/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 10 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
date:   8 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/[email protected]/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/20251122/[email protected]/reproduce)

Quoted 8 lines

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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection

That change obviously does not result in this warning/error. This appears to be another divide by zero issue but based on my analysis so far, I do not understand how...

https://github.com/ClangBuiltLinux/linux/issues/2129

Cheers,
Nathan

#2 lore raw
Quoted 18 lines · Nathan Chancellor
Quoted 17 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
date:   8 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/[email protected]/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/20251122/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection

That change obviously does not result in this warning/error. This appears to be another divide by zero issue but based on my analysis so far, I do not understand how...

https://github.com/ClangBuiltLinux/linux/issues/2129

Here ya go :-) After looking at a gazillion of these I can often spot these pretty easily. I'm not sure what the correct fix is here but this made the error go away.

drivers/media/i2c/ccs/ccs-core.c +1 -1
index 1c889c878abd..2429c05bffb3 100644
@@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
 	max_m = crops[CCS_PAD_SINK]->width
 		* CCS_LIM(sensor, SCALER_N_MIN)
-		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
+		/ (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ? : 1);
 
 	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
 		  CCS_LIM(sensor, SCALER_M_MAX));
#3 lore raw
Quoted 36 lines · Josh Poimboeuf
Quoted 18 lines · Nathan Chancellor
Quoted 17 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
date:   8 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/[email protected]/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/20251122/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection

That change obviously does not result in this warning/error. This appears to be another divide by zero issue but based on my analysis so far, I do not understand how...

https://github.com/ClangBuiltLinux/linux/issues/2129

Here ya go :-) After looking at a gazillion of these I can often spot these pretty easily. I'm not sure what the correct fix is here but this made the error go away.

drivers/media/i2c/ccs/ccs-core.c +0 -0
index 1c889c878abd..2429c05bffb3 100644

drivers/media/i2c/ccs/ccs-core.c static void ccs_set_compose_scaler(struct v4l2_subdev *subdev, · line 2352

Quoted 8 lines
drivers/media/i2c/ccs/ccs-core.c +1 -1
@@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
 	max_m = crops[CCS_PAD_SINK]->width
 		* CCS_LIM(sensor, SCALER_N_MIN)
-		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
+		/ (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ? : 1);
 
 	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
 		  CCS_LIM(sensor, SCALER_M_MAX));

Aha! Thanks a lot :) I had thought it might be something with CCS_LIM() since ccs_get_limit() returns zero if ccs_limit_ptr() errors and in the default case of the switch statement. There are a lot of unchecked divides with the result of CCS_LIM() throughout this driver so I figured if that was it, there would be other instances of this warning... oh well.

Something like the following diff also fixes it since LLVM no longer sees 0 as a possible divisor, which seems a little better to me since it seems like one of the other uses could turn problematic with other optimizations. Given these cases are both errors and have visible WARNs in case they are hit, it seems like it is better to use a valid divisor instead of 0.

Just one more warning to tackle in my personal configuration then I can enable CONFIG_OBJTOOL_WERROR to make new warnings from LLVM uprevs more obvious :)

https://github.com/ClangBuiltLinux/linux/issues/2130

drivers/media/i2c/ccs/ccs-core.c +2 -2
index 1c889c878abd..05c3da29f14c 100644
@@ -137,7 +137,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
 
        ret = ccs_limit_ptr(sensor, limit, offset, &ptr);
        if (ret)
-               return 0;
+               return 1;
 
        switch (CCI_REG_WIDTH_BYTES(ccs_limits[ccs_limit_offsets[limit].info].reg)) {
        case sizeof(u8):
@@ -151,7 +151,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
                break;
        default:
                WARN_ON(1);
-               return 0;
+               return 1;
        }
 
        return ccs_reg_conv(sensor, ccs_limits[limit].reg, val);
maintainer
#4 lore raw

Hi folks,

Quoted 32 lines · Nathan Chancellor
Quoted 31 lines · Josh Poimboeuf
Quoted 18 lines · Nathan Chancellor
Quoted 17 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
date:   8 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/[email protected]/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/20251122/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection

That change obviously does not result in this warning/error. This appears to be another divide by zero issue but based on my analysis so far, I do not understand how...

https://github.com/ClangBuiltLinux/linux/issues/2129

Here ya go :-) After looking at a gazillion of these I can often spot these pretty easily. I'm not sure what the correct fix is here but this made the error go away.

Quoted 10 lines

drivers/media/i2c/ccs/ccs-core.c static void ccs_set_compose_scaler(struct v4l2_subdev *subdev, · line 2349

Quoted 10 lines
drivers/media/i2c/ccs/ccs-core.c +1 -1
index 1c889c878abd..2429c05bffb3 100644
@@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
 	max_m = crops[CCS_PAD_SINK]->width
 		* CCS_LIM(sensor, SCALER_N_MIN)
-		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
+		/ (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ? : 1);

Thanks for cc'ing me.

I prefer this as there's no guarantee the value read via ccs_get_limit() would be non-zero. Presumably it is (and has been so far as no-one has hit this to my knowledge), but we shouldn't rely on that.

I can post a patch as well.

Quoted 46 lines

drivers/media/i2c/ccs/ccs-core.c static void ccs_set_compose_scaler(struct v4l2_subdev *subdev, · line 2351

Quoted 3 lines
drivers/media/i2c/ccs/ccs-core.c +0 -0
 	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
 		  CCS_LIM(sensor, SCALER_M_MAX));

Aha! Thanks a lot :) I had thought it might be something with CCS_LIM() since ccs_get_limit() returns zero if ccs_limit_ptr() errors and in the default case of the switch statement. There are a lot of unchecked divides with the result of CCS_LIM() throughout this driver so I figured if that was it, there would be other instances of this warning... oh well.

Something like the following diff also fixes it since LLVM no longer sees 0 as a possible divisor, which seems a little better to me since it seems like one of the other uses could turn problematic with other optimizations. Given these cases are both errors and have visible WARNs in case they are hit, it seems like it is better to use a valid divisor instead of 0.

Just one more warning to tackle in my personal configuration then I can enable CONFIG_OBJTOOL_WERROR to make new warnings from LLVM uprevs more obvious :)

https://github.com/ClangBuiltLinux/linux/issues/2130

drivers/media/i2c/ccs/ccs-core.c +2 -2
index 1c889c878abd..05c3da29f14c 100644
@@ -137,7 +137,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
 
        ret = ccs_limit_ptr(sensor, limit, offset, &ptr);
        if (ret)
-               return 0;
+               return 1;
 
        switch (CCI_REG_WIDTH_BYTES(ccs_limits[ccs_limit_offsets[limit].info].reg)) {
        case sizeof(u8):
@@ -151,7 +151,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
                break;
        default:
                WARN_ON(1);
-               return 0;
+               return 1;
        }
 
        return ccs_reg_conv(sensor, ccs_limits[limit].reg, val);
Signature · 3 lines
Kind regards,

Sakari Ailus
#5 lore raw

Hi Sakari,

Quoted 5 lines · Sakari Ailus

Thanks for cc'ing me.

I prefer this as there's no guarantee the value read via ccs_get_limit() would be non-zero. Presumably it is (and has been so far as no-one has hit this to my knowledge), but we shouldn't rely on that.

Ah, that makes sense. I misread some of the other places I thought were using the value of CCS_LIM() as a divisor, guess I forgot my elementary order of operations :) This appears to be the only overt one that I can see.

Quoted 1 line

I can post a patch as well.

If you have time, that would be great (I am happy to build test and review it). Otherwise, I can get to it soon.

Cheers,
Nathan

maintainer
#6 lore raw

PATCH 1/1 media: ccs: Avoid possible division by zero

Calculating maximum M for scaler configuration involves dividing by MIN_X_OUTPUT_SIZE limit register's value. Albeit the value is presumably non-zero, the driver was missing the check it in fact was. Fix this.

---
Not tested but what could go wrong here? :-)

 drivers/media/i2c/ccs/ccs-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-core.c +1 -1
index f8523140784c..dadff8c50679 100644
@@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
 	max_m = crops[CCS_PAD_SINK]->width
 		* CCS_LIM(sensor, SCALER_N_MIN)
-		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
+		/ (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ?: 1);
 
 	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
 		  CCS_LIM(sensor, SCALER_M_MAX));
Signature · 1 line
2.47.3
Reviewed-by Tested-by on v1 1/1
#7 lore raw

Re: [PATCH 1/1] media: ccs: Avoid possible division by zero

Quoted 10 lines · Sakari Ailus

Calculating maximum M for scaler configuration involves dividing by MIN_X_OUTPUT_SIZE limit register's value. Albeit the value is presumably non-zero, the driver was missing the check it in fact was. Fix this.

---

This clears up the objtool warning for me.

Quoted 19 lines
 drivers/media/i2c/ccs/ccs-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-core.c +1 -1
index f8523140784c..dadff8c50679 100644
@@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
 	max_m = crops[CCS_PAD_SINK]->width
 		* CCS_LIM(sensor, SCALER_N_MIN)
-		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
+		/ (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ?: 1);
 
 	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
 		  CCS_LIM(sensor, SCALER_M_MAX));
Signature · 1 line
2.47.3