Commit 1943edac authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Martin K. Petersen

scsi: ufs-mediatek: Avoid using ret uninitialized in ufs_mtk_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.

Fixes: ddd90623 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips")
Link: https://github.com/ClangBuiltLinux/linux/issues/426Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent cbb24e26
...@@ -93,7 +93,7 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, ...@@ -93,7 +93,7 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on,
enum ufs_notify_change_status status) enum ufs_notify_change_status status)
{ {
struct ufs_mtk_host *host = ufshcd_get_variant(hba); struct ufs_mtk_host *host = ufshcd_get_variant(hba);
int ret; int ret = -EINVAL;
/* /*
* In case ufs_mtk_init() is not yet done, simply ignore. * In case ufs_mtk_init() is not yet done, simply ignore.
...@@ -112,9 +112,6 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, ...@@ -112,9 +112,6 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on,
if (on) if (on)
ret = phy_power_on(host->mphy); ret = phy_power_on(host->mphy);
break; break;
default:
ret = -EINVAL;
break;
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment