Skip to content

Commit c306f74

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Fix the build for gcc 9 and before
gcc compilers before version 10 cannot do constant-folding for sub-byte bitfields. This makes the compiler layout tests fail. Hence skip the layout checks for gcc 9 and before. Cc: Arnd Bergmann <[email protected]> Cc: Naresh Kamboju <[email protected]> Cc: Nathan Chancellor <[email protected]> Reported-by: Naresh Kamboju <[email protected]> Closes: https://lore.kernel.org/linux-scsi/CA+G9fYur8UJoUyTLJFVEJPh-15TJ7kbdD2q8xVz8a3fLjkxxVw@mail.gmail.com/ Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Arnd Bergmann <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 21f04fb commit c306f74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10527,6 +10527,14 @@ static const struct dev_pm_ops ufshcd_wl_pm_ops = {
1052710527

1052810528
static void ufshcd_check_header_layout(void)
1052910529
{
10530+
/*
10531+
* gcc compilers before version 10 cannot do constant-folding for
10532+
* sub-byte bitfields. Hence skip the layout checks for gcc 9 and
10533+
* before.
10534+
*/
10535+
if (IS_ENABLED(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 100000)
10536+
return;
10537+
1053010538
BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
1053110539
.cci = 3})[0] != 3);
1053210540

0 commit comments

Comments
 (0)