net/mlx4_core: Fix error handling in mlx4_init_port_info.
authorTarick Bedeir <tarick@google.com>
Sun, 13 May 2018 23:38:45 +0000 (16:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 May 2018 20:29:08 +0000 (16:29 -0400)
commit57f6f99fdad9984801cde05c1db68fe39b474a10
tree9d6d421a3d6e40a33d29704d3df85ec0a8ebef21
parentb196d88aba8ac72b775137854121097f4c4c6862
net/mlx4_core: Fix error handling in mlx4_init_port_info.

Avoid exiting the function with a lingering sysfs file (if the first
call to device_create_file() fails while the second succeeds), and avoid
calling devlink_port_unregister() twice.

In other words, either mlx4_init_port_info() succeeds and returns zero, or
it fails, returns non-zero, and requires no cleanup.

Fixes: 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")
Signed-off-by: Tarick Bedeir <tarick@google.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c