From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Huisong Li <lihuisong@huawei.com>
Cc: <xuwei5@hisilicon.com>, <linux-kernel@vger.kernel.org>,
<soc@kernel.org>, <linux-arm-kernel@lists.infradead.org>,
<krzk@kernel.org>, <wanghuiqiang@huawei.com>,
<liuyonglong@huawei.com>
Subject: Re: [PATCH v2 2/6] soc: hisilicon: kunpeng_hccs: Return failure on having not die or port information
Date: Fri, 23 Aug 2024 09:33:45 +0100 [thread overview]
Message-ID: <20240823093345.000024f2@Huawei.com> (raw)
In-Reply-To: <20240823031059.32579-3-lihuisong@huawei.com>
On Fri, 23 Aug 2024 11:10:55 +0800
Huisong Li <lihuisong@huawei.com> wrote:
> Driver is unavailable if all die number or all port number obtained from
> firmware are zero. So return failure in this case.
Perhaps should include a little info on whether there are firmware's out
there that do this or not? I.e. Fix, or hardening?
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
Otherwise, this lgtm.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/soc/hisilicon/kunpeng_hccs.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
> index c4a57328f22a..6e88f597f267 100644
> --- a/drivers/soc/hisilicon/kunpeng_hccs.c
> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
> @@ -451,6 +451,7 @@ static int hccs_query_all_die_info_on_platform(struct hccs_dev *hdev)
> struct device *dev = hdev->dev;
> struct hccs_chip_info *chip;
> struct hccs_die_info *die;
> + bool has_die_info = false;
> u8 i, j;
> int ret;
>
> @@ -459,6 +460,7 @@ static int hccs_query_all_die_info_on_platform(struct hccs_dev *hdev)
> if (!chip->die_num)
> continue;
>
> + has_die_info = true;
> chip->dies = devm_kzalloc(hdev->dev,
> chip->die_num * sizeof(struct hccs_die_info),
> GFP_KERNEL);
> @@ -480,7 +482,7 @@ static int hccs_query_all_die_info_on_platform(struct hccs_dev *hdev)
> }
> }
>
> - return 0;
> + return has_die_info ? 0 : -EINVAL;
> }
>
> static int hccs_get_bd_info(struct hccs_dev *hdev, u8 opcode,
> @@ -601,6 +603,7 @@ static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev)
> struct device *dev = hdev->dev;
> struct hccs_chip_info *chip;
> struct hccs_die_info *die;
> + bool has_port_info = false;
> u8 i, j;
> int ret;
>
> @@ -611,6 +614,7 @@ static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev)
> if (!die->port_num)
> continue;
>
> + has_port_info = true;
> die->ports = devm_kzalloc(dev,
> die->port_num * sizeof(struct hccs_port_info),
> GFP_KERNEL);
> @@ -629,7 +633,7 @@ static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev)
> }
> }
>
> - return 0;
> + return has_port_info ? 0 : -EINVAL;
> }
>
> static int hccs_get_hw_info(struct hccs_dev *hdev)
next prev parent reply other threads:[~2024-08-23 8:33 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 7:11 [PATCH 0/5] Add some features and bugfix for kunpeng_hccs Huisong Li
2024-07-18 7:11 ` [PATCH 1/5] soc: hisilicon: kunpeng_hccs: fix a PCC typo Huisong Li
2024-07-18 7:11 ` [PATCH 2/5] soc: hisilicon: kunpeng_hccs: return failure on having not die or port information Huisong Li
2024-07-18 7:11 ` [PATCH 3/5] soc: hisilicon: kunpeng_hccs: add used HCCS type sysfs on platform Huisong Li
[not found] ` <66AB7194.1060404@hisilicon.com>
2024-08-09 4:07 ` lihuisong (C)
2024-07-18 7:11 ` [PATCH 4/5] soc: hisilicon: kunpeng_hccs: support low power feature for specified HCCS Huisong Li
2024-07-28 11:55 ` Krzysztof Kozlowski
2024-08-09 4:06 ` lihuisong (C)
2024-07-18 7:11 ` [PATCH 5/5] doc: soc: hisilicon: kunpeng_hccs: add low power interface description for HCCS Huisong Li
2024-08-23 3:10 ` [PATCH v2 0/6] Add some features and bugfix for kunpeng_hccs Huisong Li
2024-08-23 3:10 ` [PATCH v2 1/6] soc: hisilicon: kunpeng_hccs: Fix a PCC typo Huisong Li
2024-08-23 8:32 ` Jonathan Cameron
2024-08-23 3:10 ` [PATCH v2 2/6] soc: hisilicon: kunpeng_hccs: Return failure on having not die or port information Huisong Li
2024-08-23 8:33 ` Jonathan Cameron [this message]
2024-08-27 11:04 ` lihuisong (C)
2024-08-23 3:10 ` [PATCH v2 3/6] soc: hisilicon: kunpeng_hccs: Add the check for base address and size of shared memory Huisong Li
2024-08-23 8:38 ` Jonathan Cameron
2024-08-27 11:12 ` lihuisong (C)
2024-08-23 3:10 ` [PATCH v2 4/6] soc: hisilicon: kunpeng_hccs: Fix the 'lane_mode' field name in port info structure to 'max_lane_num' Huisong Li
2024-08-23 8:40 ` Jonathan Cameron
2024-08-27 11:15 ` lihuisong (C)
2024-08-23 3:10 ` [PATCH v2 5/6] soc: hisilicon: kunpeng_hccs: Add used HCCS types sysfs Huisong Li
2024-08-23 8:47 ` Jonathan Cameron
2024-08-27 11:32 ` lihuisong (C)
2024-08-23 3:10 ` [PATCH v2 6/6] soc: hisilicon: kunpeng_hccs: Support low power feature for the specified HCCS type Huisong Li
2024-08-23 8:58 ` Jonathan Cameron
2024-08-27 11:48 ` lihuisong (C)
2024-08-27 11:59 ` Jonathan Cameron
2024-08-23 9:02 ` [PATCH v2 0/6] Add some features and bugfix for kunpeng_hccs Jonathan Cameron
2024-08-27 11:49 ` lihuisong (C)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823093345.000024f2@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=krzk@kernel.org \
--cc=lihuisong@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=soc@kernel.org \
--cc=wanghuiqiang@huawei.com \
--cc=xuwei5@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox