public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: net: wwan: Hold runtime PM during active data path operations
Date: Mon, 25 May 2026 19:03:04 +1000	[thread overview]
Message-ID: <review-patch5-20260522-mhi_runtimepm-v2-5-fbebf41a82bb@oss.qualcomm.com> (raw)
In-Reply-To: <20260522-mhi_runtimepm-v2-5-fbebf41a82bb@oss.qualcomm.com>

Patch Review

**Issue 1 - Inconsistent PM API usage between the two drivers in the same patch:**

`mhi_wwan_ctrl` uses `pm_runtime_resume_and_get` (synchronous, proper error returns) throughout:
```c
+	ret = pm_runtime_resume_and_get(&mhi_dev->dev);
+	if (ret) {
```

But `mhi_wwan_mbim` uses raw `pm_runtime_get` (async) in several places:
```c
+	err = pm_runtime_get(&mhi_dev->dev);
+	if (err < 0 && err != -EINPROGRESS) {
```

This inconsistency within a single patch is concerning. The `mhi_wwan_ctrl` approach is generally more correct for non-atomic contexts like probe, remove, and workqueues. The xmit path is the only place where async `pm_runtime_get` is justified (because xmit might be in atomic context).

**Issue 2 - mhi_wwan_mbim rx_refill_work missing error handling:**

```c
+	err = pm_runtime_get(&mdev->dev);
+	if (err < 0 && err != -EINPROGRESS)
+		dev_err(&mdev->dev, "pm_runtime_get Failed %d\n", err);
+
 	while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) {
```

On PM failure, it logs an error but **proceeds into the loop anyway**, queueing buffers on a potentially suspended device. Compare with `mhi_wwan_ctrl_refill_work` which properly returns on error. This is a bug.

**Issue 3 - mhi_mbim_remove unconditional pm_runtime_put:**

```c
+	err = pm_runtime_get(&mhi_dev->dev);
+	if (err < 0 && err != -EINPROGRESS)
+		dev_err(...);
     ...
+	pm_runtime_put(&mhi_dev->dev);
```

The `pm_runtime_put` is called unconditionally, even if `pm_runtime_get` failed. Compare with `mhi_wwan_ctrl_stop` which conditionally puts only on success. If `pm_runtime_get` returned an error other than `-EINPROGRESS`, calling `pm_runtime_put` would decrement the usage count below zero.

**Issue 4 - mhi_mbim_probe leaks `mbim` allocation on PM failure:**

```c
 	mbim = kzalloc(sizeof(*mbim), GFP_KERNEL);
 	if (!mbim)
 		return -ENOMEM;
 
+	pm_runtime_no_callbacks(&mhi_dev->dev);
+	err = devm_pm_runtime_set_active_enabled(&mhi_dev->dev);
+	if (err)
+		return err;
```

If `devm_pm_runtime_set_active_enabled` fails, `mbim` is leaked (no `kfree`). The `mhi_wwan_ctrl` side handles this correctly by calling `kfree(mhiwwan)` on failure.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25  9:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 10:00 [PATCH v2 0/6] bus: mhi: Fix broken runtime PM design Krishna Chaitanya Chundru
2026-05-22 10:00 ` [PATCH v2 1/6] bus: mhi: Replace controller runtime_get/put callbacks with direct PM runtime APIs Krishna Chaitanya Chundru
2026-05-25  9:03   ` Claude review: " Claude Code Review Bot
2026-05-22 10:00 ` [PATCH v2 2/6] bus: mhi: Drop controller runtime PM callback indirection Krishna Chaitanya Chundru
2026-05-25  9:03   ` Claude review: " Claude Code Review Bot
2026-05-22 10:00 ` [PATCH v2 3/6] net: mhi_net: Hold runtime PM during active data path operations Krishna Chaitanya Chundru
2026-05-22 20:09   ` Loic Poulain
2026-05-25  9:03   ` Claude review: " Claude Code Review Bot
2026-05-22 10:00 ` [PATCH v2 4/6] net: qrtr: " Krishna Chaitanya Chundru
2026-05-25  9:03   ` Claude review: " Claude Code Review Bot
2026-05-22 10:00 ` [PATCH v2 5/6] net: wwan: " Krishna Chaitanya Chundru
2026-05-25  9:03   ` Claude Code Review Bot [this message]
2026-05-22 10:00 ` [PATCH v2 6/6] bus: mhi: host: Fix runtime PM ownership between clients and controller Krishna Chaitanya Chundru
2026-05-25  9:03   ` Claude review: " Claude Code Review Bot
2026-05-25  9:03 ` Claude review: bus: mhi: Fix broken runtime PM design Claude Code Review Bot

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=review-patch5-20260522-mhi_runtimepm-v2-5-fbebf41a82bb@oss.qualcomm.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /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