From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ali Alnubani Subject: [PATCH] net/mlx5: add missing return value check Date: Thu, 21 Mar 2019 09:07:26 +0000 Message-ID: <20190321090652.32535-1-alialnu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Shahaf Shuler , Dekel Peled To: "dev@dpdk.org" Return-path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140045.outbound.protection.outlook.com [40.107.14.45]) by dpdk.org (Postfix) with ESMTP id A160B1B44E for ; Thu, 21 Mar 2019 10:07:27 +0100 (CET) Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixes: d86406b965df ("net/mlx5: support new representor naming format") Cc: dekelp@mellanox.com Signed-off-by: Ali Alnubani --- drivers/net/mlx5/mlx5_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.= c index 84d761c8e..1fd988998 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -1365,6 +1365,7 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct m= lx5_switch_info *info) bool port_name_set =3D false; bool port_switch_id_set =3D false; char c; + int ret; =20 if (!if_indextoname(ifindex, ifname)) { rte_errno =3D errno; @@ -1378,9 +1379,10 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct = mlx5_switch_info *info) =20 file =3D fopen(phys_port_name, "rb"); if (file !=3D NULL) { - fscanf(file, "%s", port_name); + ret =3D fscanf(file, "%s", port_name); fclose(file); - port_name_set =3D mlx5_translate_port_name(port_name, &data); + if (ret =3D=3D 1) + port_name_set =3D mlx5_translate_port_name(port_name, &data); } file =3D fopen(phys_switch_id, "rb"); if (file =3D=3D NULL) { --=20 2.19.2