Re: [PATCH v3 17/18] nvmem: layouts: Add ONIE tlv layout driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 18, 2022 at 07:51:17PM +0100, Michael Walle wrote:
> From: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> 
> 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.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux