devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Sascha Hauer <sha@pengutronix.de>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 17/18] nvmem: layouts: Add ONIE tlv layout driver
Date: Wed, 23 Nov 2022 10:52:24 +0100	[thread overview]
Message-ID: <03a2791283d26c847d07852506e9d48f@walle.cc> (raw)
In-Reply-To: <20221121075144.GL3143@pengutronix.de>

Am 2022-11-21 08:51, schrieb Sascha Hauer:
> On Fri, Nov 18, 2022 at 07:51:17PM +0100, Michael Walle wrote:
>> From: Miquel Raynal <miquel.raynal@bootlin.com>
>> 
>> This layout applies no top of any non volatile storage device 
>> containing
> 
> s/no/on/
> 
>> +	table_len = hdr_len + data_len;
>> +	if (table_len > ONIE_TLV_MAX_LEN) {
>> +		dev_err(dev, "Invalid ONIE TLV data length\n");
>> +		return -EINVAL;
>> +	}
>> +
>> +	table = devm_kmalloc(dev, table_len, GFP_KERNEL);
>> +	if (!table)
>> +		return -ENOMEM;
>> +
>> +	ret = nvmem_device_read(nvmem, 0, table_len, table);
>> +	if (ret != table_len)
>> +		goto free_data_buf;
>> +
>> +	if (!onie_tlv_crc_is_valid(dev, table_len, table)) {
>> +		ret = -EINVAL;
>> +		goto free_data_buf;
>> +	}
>> +
>> +	data = table + hdr_len;
>> +	ret = onie_tlv_add_cells(dev, nvmem, data_len, data);
>> +	if (ret)
>> +		goto free_data_buf;
>> +
>> +free_data_buf:
>> +	kfree(table);
> 
> This is allocated with devm_kmalloc(), you shouldn't free it here.

Miquel, should I drop your patches or should I fix this in place and
repost them?

Also, there is a mistake in nvmem_add_cells_from_layout() which doesn't
handle the return code. Probably a leftover from before when I had
.add_cells() return void.

-michael

  reply	other threads:[~2022-11-23  9:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 18:51 [PATCH v3 00/18] nvmem: core: introduce NVMEM layouts Michael Walle
2022-11-18 18:51 ` [PATCH v3 01/18] net: add helper eth_addr_add() Michael Walle
2022-11-18 18:51 ` [PATCH v3 02/18] of: base: add of_parse_phandle_with_optional_args() Michael Walle
2022-11-18 21:31   ` Michael Walle
2022-11-18 21:40     ` [PATCH] of: property: special #nvmem-cell-cells handling Michael Walle
2022-11-18 21:52       ` Rob Herring
2022-11-18 22:03         ` Michael Walle
2022-11-22 23:44           ` Rob Herring
2022-11-23 12:24             ` Miquel Raynal
2022-11-18 18:51 ` [PATCH v3 03/18] nvmem: core: fix device node refcounting Michael Walle
2022-11-18 18:51 ` [PATCH v3 04/18] nvmem: core: add an index parameter to the cell Michael Walle
2022-11-18 18:51 ` [PATCH v3 05/18] nvmem: core: move struct nvmem_cell_info to nvmem-provider.h Michael Walle
2022-11-18 18:51 ` [PATCH v3 06/18] nvmem: core: drop the removal of the cells in nvmem_add_cells() Michael Walle
2022-11-21  7:56   ` Sascha Hauer
2022-11-18 18:51 ` [PATCH v3 07/18] nvmem: core: add nvmem_add_one_cell() Michael Walle
2022-11-18 18:51 ` [PATCH v3 08/18] nvmem: core: use nvmem_add_one_cell() in nvmem_add_cells_from_of() Michael Walle
2022-11-18 18:51 ` [PATCH v3 09/18] nvmem: core: introduce NVMEM layouts Michael Walle
2022-11-18 18:51 ` [PATCH v3 10/18] nvmem: core: add per-cell post processing Michael Walle
2022-11-18 18:51 ` [PATCH v3 11/18] nvmem: core: allow to modify a cell before adding it Michael Walle
2022-11-18 18:51 ` [PATCH v3 12/18] nvmem: imx-ocotp: replace global post processing with layouts Michael Walle
2022-11-18 18:51 ` [PATCH v3 13/18] nvmem: cell: drop global cell_post_process Michael Walle
2022-11-18 18:51 ` [PATCH v3 14/18] nvmem: core: provide own priv pointer in post process callback Michael Walle
2022-11-18 18:51 ` [PATCH v3 15/18] nvmem: layouts: add sl28vpd layout Michael Walle
2022-11-18 18:51 ` [PATCH v3 16/18] MAINTAINERS: add myself as sl28vpd nvmem layout driver Michael Walle
2022-11-18 18:51 ` [PATCH v3 17/18] nvmem: layouts: Add ONIE tlv " Michael Walle
2022-11-21  7:51   ` Sascha Hauer
2022-11-23  9:52     ` Michael Walle [this message]
2022-11-18 18:51 ` [PATCH v3 18/18] MAINTAINERS: Add myself as ONIE tlv NVMEM layout maintainer Michael Walle

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=03a2791283d26c847d07852506e9d48f@walle.cc \
    --to=michael@walle.cc \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=sha@pengutronix.de \
    --cc=srinivas.kandagatla@linaro.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).