devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Zhenhua Huang <quic_zhenhuah@quicinc.com>,
	agross@kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@quicinc.com,
	quic_tingweiz@quicinc.com
Subject: Re: [PATCH v1 3/5] soc: qcom: memory_dump: Add memory dump driver
Date: Mon, 23 Oct 2023 13:46:54 +0200	[thread overview]
Message-ID: <454c4267-6bb7-456e-8dc1-cba83ffd1641@linaro.org> (raw)
In-Reply-To: <b455d4f7-0347-ac07-6d41-32b3f06c4f0a@quicinc.com>

On 23/10/2023 13:43, Zhenhua Huang wrote:
>>> +
>>> +			mem_dump_apply_offset(&dump_vaddr, &phys_addr,
>>> +					      size + QCOM_DUMP_DATA_SIZE);
>>> +			if (phys_addr > phys_end_addr) {
>>> +				dev_err_probe(dev, -ENOMEM, "Exceeding allocated region\n");
>>
>> ENOMEM? Does not look right then.
> 
> ENOMEM means the memory allocated not enough? any suggestion? Thanks.

The error code is okay, but we rarely need to print error messages for
memory allocation failures. Core prints it already.

> 
>>
>>> +				return -ENOMEM;
>>> +			}
>>> +		} else {
>>> +			continue;
>>> +		}
>>> +	}
>>> +
>>> +	return ret;
>>> +}
>>> +
>>> +static int __init mem_dump_probe(struct platform_device *pdev)
>>> +{
>>> +	struct qcom_memory_dump *memdump;
>>> +	struct device *dev = &pdev->dev;
>>> +	struct page *page;
>>> +	size_t total_size;
>>> +	int ret = 0;
>>> +
>>> +	memdump = devm_kzalloc(dev, sizeof(struct qcom_memory_dump),
>>> +			       GFP_KERNEL);
>>> +	if (!memdump)
>>> +		return -ENOMEM;
>>> +
>>> +	dev_set_drvdata(dev, memdump);
>>> +
>>> +	/* check and initiate CMA region */
>>> +	ret = mem_dump_reserve_mem(dev);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>> +	/* allocate and populate */
>>> +	page = mem_dump_alloc_mem(dev, &total_size);
>>> +	if (IS_ERR(page)) {
>>> +		ret = PTR_ERR(page);
>>> +		dev_err_probe(dev, ret, "mem dump alloc failed\n");
>>
>> No, the syntax is:
>> ret = dev_err_probe
>>
>> But why do you print messgaes for memory allocations?
> 
> Do you think it's useless because mm codes should print error as well if 
> failure ?

We fixed this in kernel long, long, long time ago so we have even
coccicheck scripts to find misuses.



Best regards,
Krzysztof


  reply	other threads:[~2023-10-23 11:47 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  9:20 [PATCH v1 0/5] soc/arm64: qcom: add initial version of memory dump Zhenhua Huang
2023-10-23  9:20 ` [PATCH v1 1/5] dt-bindings: soc: qcom: Add memory_dump driver bindings Zhenhua Huang
2023-10-23  9:27   ` Krzysztof Kozlowski
2023-10-23 11:54     ` Zhenhua Huang
2023-10-23 12:52       ` Krzysztof Kozlowski
2023-10-24 10:57         ` Zhenhua Huang
2023-10-24 13:55           ` Krzysztof Kozlowski
2023-10-26 21:01     ` Elliot Berman
2023-10-23 17:40   ` Rob Herring
2023-10-23  9:20 ` [PATCH v1 2/5] dt-bindings: sram: qcom,imem: document sm8250 Zhenhua Huang
2023-10-23  9:27   ` Krzysztof Kozlowski
2023-10-23 17:40   ` Rob Herring
2023-10-24 11:07     ` Zhenhua Huang
2023-10-23  9:20 ` [PATCH v1 3/5] soc: qcom: memory_dump: Add memory dump driver Zhenhua Huang
2023-10-23  9:31   ` Krzysztof Kozlowski
2023-10-23 11:43     ` Zhenhua Huang
2023-10-23 11:46       ` Krzysztof Kozlowski [this message]
2023-10-23 12:19         ` Zhenhua Huang
2023-10-23 12:53           ` Krzysztof Kozlowski
2023-10-24 10:57             ` Zhenhua Huang
2023-10-24 13:58               ` Krzysztof Kozlowski
2023-10-23 13:56   ` Konrad Dybcio
2023-10-24  7:36     ` Zhenhua Huang
2023-10-26 18:58   ` kernel test robot
2023-10-23  9:20 ` [PATCH v1 4/5] arm64: defconfig: enable Qcom Memory Dump driver Zhenhua Huang
2023-10-23  9:32   ` Krzysztof Kozlowski
2023-10-23 11:43     ` Zhenhua Huang
2023-10-23 11:47       ` Krzysztof Kozlowski
2023-10-23 12:19         ` Zhenhua Huang
2023-10-23  9:20 ` [PATCH v1 5/5] arm64: dts: qcom: sm8250: Add memory dump node Zhenhua Huang
2023-10-23  9:33   ` Krzysztof Kozlowski
2023-10-23  9:25 ` [PATCH v1 0/5] soc/arm64: qcom: add initial version of memory dump Krzysztof Kozlowski
2023-10-23 12:18   ` Zhenhua Huang
2023-10-23 12:54     ` Krzysztof Kozlowski
2023-10-23 13:50 ` Konrad Dybcio
2023-10-24 10:10   ` Zhenhua Huang
2023-10-24 14:25     ` Jeff Johnson
2023-10-23 14:31 ` Caleb Connolly
2023-10-24  9:53   ` Zhenhua Huang

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=454c4267-6bb7-456e-8dc1-cba83ffd1641@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@quicinc.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_tingweiz@quicinc.com \
    --cc=quic_zhenhuah@quicinc.com \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).