public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Łukasz Bartosik" <ukaszb@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lee Jones <lee@kernel.org>, Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
	Pavan Holla <pholla@chromium.org>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev
Subject: Re: [PATCH v5 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
Date: Fri, 6 Sep 2024 17:19:33 +0300	[thread overview]
Message-ID: <ZtsPdWRHkHWufsVh@kuha.fi.intel.com> (raw)
In-Reply-To: <20240903163033.3170815-4-ukaszb@chromium.org>

Hi,

Sorry to go back on this, but I noticed something..

On Tue, Sep 03, 2024 at 04:30:28PM +0000, Łukasz Bartosik wrote:
> +static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
> +{
> +	struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
> +	struct ec_params_ucsi_ppm_set *req;
> +	size_t req_len;
> +	int ret;
> +
> +	req_len = sizeof(struct ec_params_ucsi_ppm_set) + sizeof(cmd);
> +	req = kzalloc(req_len, GFP_KERNEL);
> +	if (!req)
> +		return -ENOMEM;

Where is the memory for req released?

First I though that cros_ec_cmd() does it, but it's actually
allocating it's own cros_ec_command, and then releasing that in the
end, so I just got confused about it.

Is this a memory leak, or am I missing something?

> +
> +	req->offset = UCSI_CONTROL;
> +	memcpy(req->data, &cmd, sizeof(cmd));
> +	ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_SET,
> +			  req, req_len, NULL, 0);
> +	if (ret < 0) {
> +		dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
> +		return ret;
> +	}
> +	return 0;
> +}

thanks,

-- 
heikki

  parent reply	other threads:[~2024-09-06 14:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 16:30 [PATCH v5 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 1/8] platform/chrome: Update ChromeOS EC header for UCSI Łukasz Bartosik
2024-09-06  8:44   ` Tzung-Bi Shih
2024-09-06 13:01     ` Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
2024-09-06  8:44   ` Tzung-Bi Shih
2024-09-06 13:53     ` Łukasz Bartosik
2024-09-06 14:07       ` Greg Kroah-Hartman
2024-09-06 15:11         ` Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver Łukasz Bartosik
2024-09-05 11:23   ` Heikki Krogerus
2024-09-06 14:19   ` Heikki Krogerus [this message]
2024-09-06 15:19     ` Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 5/8] usb: typec: cros_ec_ucsi: Add trace events Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs Łukasz Bartosik
2024-09-03 16:30 ` [PATCH v5 8/8] mfd: cros_ec: Don't load charger with UCSI Łukasz Bartosik

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=ZtsPdWRHkHWufsVh@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abhishekpandit@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=lee@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pholla@chromium.org \
    --cc=tzungbi@kernel.org \
    --cc=ukaszb@chromium.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