lkml.org 
[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] media: camss: csiphy-3ph: avoid undefined behavior
On Fri, Dec 16, 2022, at 12:23, Peter Zijlstra wrote:
> On Thu, Dec 15, 2022 at 05:28:46PM +0100, Arnd Bergmann wrote:
>> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> index 451a4c9b3d30..04baa80494c6 100644
>> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> @@ -429,7 +429,8 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy,
>> array_size = ARRAY_SIZE(lane_regs_sm8250[0]);
>> break;
>> default:
>> - unreachable();
>> + WARN(1, "unknown cspi version\n");
>> + return;
>> }
>
> So no real objection here; but unreachable() does have an objtool
> annotation inside, so clearly the compiler managed to defeat that --
> perhaps we should look at that too.

Ah, I forgot this annotation existed. I see that this
particular objtool warning only happens with clang (I used
version 14.0.6), but it does not happen with gcc-12.2.

I see the function ends in

jmp .LBB3_45
.LBB3_54:
#APP
.Ltmp0:
.section .discard.unreachable,"",@progbits
.Ltmp1:
.long .Ltmp0-.Ltmp1
.text
#NO_APP
.Lfunc_end3:
.size csiphy_lanes_enable, .Lfunc_end3-csiphy_lanes_enable
# -- End function


full assembler output at https://pastebin.com/F8HGCUvk, object file
attached.

Arnd[unhandled content-type:application/x-xz]
\
 
 \ /
  Last update: 2022-12-16 12:50    [W:0.036 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site