Skip to content

Commit b77f016

Browse files
andy-shevdavem330
authored andcommitted
bnx2x: Reuse bnx2x_null_format_ver()
Reuse bnx2x_null_format_ver() in functions where it's appropriated instead of open coded variant. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 55b218c commit b77f016

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6161,14 +6161,20 @@ static void bnx2x_link_int_ack(struct link_params *params,
61616161
}
61626162
}
61636163

6164+
static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
6165+
{
6166+
str[0] = '\0';
6167+
(*len)--;
6168+
return 0;
6169+
}
6170+
61646171
static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
61656172
{
61666173
u16 ret;
61676174

61686175
if (*len < 10) {
61696176
/* Need more than 10chars for this format */
6170-
*str = '\0';
6171-
(*len)--;
6177+
bnx2x_null_format_ver(num, str, len);
61726178
return -EINVAL;
61736179
}
61746180

@@ -6183,8 +6189,7 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
61836189

61846190
if (*len < 10) {
61856191
/* Need more than 10chars for this format */
6186-
*str = '\0';
6187-
(*len)--;
6192+
bnx2x_null_format_ver(num, str, len);
61886193
return -EINVAL;
61896194
}
61906195

@@ -6193,13 +6198,6 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
61936198
return 0;
61946199
}
61956200

6196-
static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
6197-
{
6198-
str[0] = '\0';
6199-
(*len)--;
6200-
return 0;
6201-
}
6202-
62036201
int bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 *version,
62046202
u16 len)
62056203
{

0 commit comments

Comments
 (0)