lkml.org 
[lkml]   [2023]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v9 2/5] phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY
From

Hi,

On 25.07.23 05:31, Stanley Chang wrote:
> +static int get_phy_data_by_efuse(struct rtk_phy *rtk_phy,
> + struct phy_parameter *phy_parameter, int index)
> +{
> + struct phy_cfg *phy_cfg = rtk_phy->phy_cfg;
> + u8 value = 0;
> + struct nvmem_cell *cell;
> + struct soc_device_attribute rtk_soc_groot[] = {
> + { .family = "Realtek Groot",},
> + { /* empty */ } };
> +
> + if (!phy_cfg->check_efuse)
> + goto out;
> +
> + /* Read efuse for usb dc cal */
> + cell = nvmem_cell_get(rtk_phy->dev, "usb-dc-cal");
> + if (IS_ERR(cell)) {
> + dev_dbg(rtk_phy->dev, "%s no usb-dc-cal: %ld\n",
> + __func__, PTR_ERR(cell));
> + } else {
> + unsigned char *buf;
> + size_t buf_size;
> +
> + buf = nvmem_cell_read(cell, &buf_size);
> + value = buf[0] & phy_cfg->dc_driving_mask;
> +
> + kfree(buf);
> + nvmem_cell_put(cell);

nvmem_cell_read() can take NULL as the second argument.
You are throwing away buf_size anyway.

Regards
Oliver

\
 
 \ /
  Last update: 2023-07-26 10:27    [W:0.044 / U:1.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site