Skip to content

Commit 94e7c84

Browse files
nathanchancedavem330
authored andcommitted
net: lan78xx: Avoid unnecessary self assignment
Clang warns when a variable is assigned to itself. drivers/net/usb/lan78xx.c:940:11: warning: explicitly assigning value of variable of type 'u32' (aka 'unsigned int') to itself [-Wself-assign] offset = offset; ~~~~~~ ^ ~~~~~~ 1 warning generated. Reorder the if statement to acheive the same result and avoid a self assignment warning. Link: ClangBuiltLinux/linux#129 Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6b8e327 commit 94e7c84

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,9 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
936936
ret = lan78xx_read_raw_otp(dev, 0, 1, &sig);
937937

938938
if (ret == 0) {
939-
if (sig == OTP_INDICATOR_1)
940-
offset = offset;
941-
else if (sig == OTP_INDICATOR_2)
939+
if (sig == OTP_INDICATOR_2)
942940
offset += 0x100;
943-
else
941+
else if (sig != OTP_INDICATOR_1)
944942
ret = -EINVAL;
945943
if (!ret)
946944
ret = lan78xx_read_raw_otp(dev, offset, length, data);

0 commit comments

Comments
 (0)