From: Huisong Li Date: Wed, 17 Apr 2024 09:48:00 +0000 (+0800) Subject: soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/192f97fe164dd946d0da54bf6e17ff6f9ab9ba43 soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute The hccs_get_all_port_attr() is used to obtain the attribute of all the ports on a specified DIE from the firmware. However this interface doesn't ensure whether the firmware reports the complete attribute of all the ports or not. So this patch adds the check for this. Signed-off-by: Huisong Li Signed-off-by: Wei Xu --- diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c index 9ff70b38e5e9..e882a61636ec 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -556,6 +556,12 @@ static int hccs_get_all_port_attr(struct hccs_dev *hdev, start_id = rsp_head.next_id; } + if (left_buf_len != 0) { + dev_err(hdev->dev, "failed to get the expected port number(%u) attribute.\n", + size); + return -EINVAL; + } + return 0; }