Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wsometimes-uninitialized in drivers/scsi/ufs/ufs-mediatek.c #426

Closed
nathanchance opened this issue Mar 20, 2019 · 2 comments
Closed

-Wsometimes-uninitialized in drivers/scsi/ufs/ufs-mediatek.c #426

nathanchance opened this issue Mar 20, 2019 · 2 comments
Assignees
Labels
-Wsometimes-uninitialized [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle

Comments

@nathanchance
Copy link
Member

drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                if (on)
                    ^~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its condition is always true
                if (on)
                ^~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                if (!on)
                    ^~~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its condition is always true
                if (!on)
                ^~~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0
2 warnings generated.

Patch sent: https://lore.kernel.org/lkml/20190320180340.25795-1-natechancellor@gmail.com/

@nathanchance nathanchance added [PATCH] Submitted A patch has been submitted for review [BUG] linux-next This is an issue only seen in linux-next -Wsometimes-uninitialized labels Mar 20, 2019
@nathanchance nathanchance self-assigned this Mar 20, 2019
@nathanchance nathanchance changed the title -Wsometimes-uninitialized in -Wsometimes-uninitialized in drivers/scsi/ufs/ufs-mediatek.c Mar 20, 2019
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Mar 21, 2019
fengguang pushed a commit to 0day-ci/linux that referenced this issue Mar 21, 2019
…ocks

When building with -Wsometimes-uninitialized, Clang warns:

drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                if (on)
                    ^~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its
condition is always true
                if (on)
                ^~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                if (!on)
                    ^~~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its
condition is always true
                if (!on)
                ^~~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable
'ret' to silence this warning
        int ret;
               ^
                = 0
2 warnings generated.

Remove the default case and initialize ret to -EINVAL to properly fix
this warning.

Fixes: ddd9062 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips")
Link: ClangBuiltLinux#426
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Mar 22, 2019
itisFarzin pushed a commit to itisFarzin-Phone/kernel_daria_mt6877 that referenced this issue Apr 29, 2024
…k_setup_clocks

When building with -Wsometimes-uninitialized, Clang warns:

drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                if (on)
                    ^~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its
condition is always true
                if (on)
                ^~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                if (!on)
                    ^~~
drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs
here
        return ret;
               ^~~
drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its
condition is always true
                if (!on)
                ^~~~~~~~
drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable
'ret' to silence this warning
        int ret;
               ^
                = 0
2 warnings generated.

Remove the default case and initialize ret to -EINVAL to properly fix
this warning.

Change-Id: I268f97dc4f05fb2f39d8f876702cb12ab7017799
Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips")
Link: ClangBuiltLinux/linux#426
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
CR-Id: ALPS04358218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wsometimes-uninitialized [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle
Projects
None yet
Development

No branches or pull requests

1 participant