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: drm/amd/pm: Use guard(mutex) instead of manual lock+unlock
Date: Sat, 16 May 2026 12:18:26 +1000	[thread overview]
Message-ID: <review-patch1-20260508024744.6523-1-andrejhirata@usp.br> (raw)
In-Reply-To: <20260508024744.6523-1-andrejhirata@usp.br>

Patch Review

**Bug 1 (critical): Logic inversion in `amdgpu_dpm_is_link_reset_supported`**

The original code calls `smu_link_reset_is_support()` only when `is_support_sw_smu(adev)` is **true**:
```c
if (is_support_sw_smu(adev)) {
    mutex_lock(&adev->pm.mutex);
    support_link_reset = smu_link_reset_is_support(smu);
    mutex_unlock(&adev->pm.mutex);
}
```

The v3 patch inverts the condition:
```c
if (is_support_sw_smu(adev))
    return false;

guard(mutex)(&adev->pm.mutex);
return smu_link_reset_is_support(smu);
```

This returns `false` when sw_smu IS supported (should query the function), and calls `smu_link_reset_is_support` when it's NOT supported (should return `false`). The condition should be `if (!is_support_sw_smu(adev))`. Compare with the correctly negated `amdgpu_dpm_mode1_reset` and `amdgpu_dpm_link_reset` conversions in the same patch.

**Bug 2 (build-breaking): Missing semicolon in `amdgpu_dpm_is_mode1_reset_supported`**

```c
guard(mutex)(&adev->pm.mutex);
return smu_mode1_reset_is_support(smu)
}
```

Missing semicolon after the `return` statement.

**Bug 3 (build-breaking): `return =` syntax errors**

Four instances of `return =` instead of `return`:

1. `amdgpu_dpm_smu_i2c_bus_access`:
   ```c
   return = pp_funcs->smu_i2c_bus_access(pp_handle, acquire);
   ```

2. `amdgpu_dpm_get_pp_table`:
   ```c
   return = pp_funcs->get_pp_table(adev->powerplay.pp_handle, table);
   ```

3. `amdgpu_dpm_set_fine_grain_clk_vol`:
   ```c
   return = pp_funcs->set_fine_grain_clk_vol(adev->powerplay.pp_handle, ...);
   ```

4. `amdgpu_dpm_get_display_mode_validation_clocks`:
   ```c
   return = pp_funcs->get_display_mode_validation_clocks(adev->powerplay.pp_handle, clocks);
   ```

All four should be just `return` (no `=`).

**Nit: Superfluous `return;` at end of `amdgpu_dpm_get_current_power_state`**

```c
*state = adev->pm.dpm.user_state;

-out:
-	mutex_unlock(&adev->pm.mutex);
+	return;
 }
```

The trailing `return;` at the end of a void function is unnecessary. The old `goto out` -> `return;` conversion is correct, but the one at the very end of the function body should be dropped.

**Observation: The RESEND/v1 patch did not have any of these bugs** -- it was a simpler mechanical conversion that kept `ret` variables and only swapped lock/unlock for `guard()`. The bugs were introduced in v2/v3 during the more aggressive refactoring to use direct `return f()` and early-return patterns. It would be worth running a `make` build test before submitting v4.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-16  2:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  2:47 [PATCH RESEND] drm/amd/pm: Use guard(mutex) instead of manual lock+unlock Andre Hirata
2026-05-08  8:43 ` Christian König
2026-05-08 10:36   ` Andre Jun Hirata
2026-05-08 11:12 ` [PATCH v2] " Andre Jun Hirata
2026-05-08 12:44   ` Christian König
2026-05-08 14:21   ` [PATCH v3] " Andre Jun Hirata
2026-05-08 17:23     ` [PATCH v4] " Andre Jun Hirata
2026-05-08 23:03       ` [PATCH v5] " Andre Jun Hirata
2026-05-11  4:58         ` Wang, Yang(Kevin)
2026-05-11 12:42           ` [PATCH v6] " Andre Jun Hirata
2026-05-11 13:50             ` Lazar, Lijo
2026-05-12 23:04               ` [PATCH v7] " Andre Jun Hirata
2026-05-13  5:38                 ` [PATCH v8] " Andre Jun Hirata
2026-05-13  4:39         ` [PATCH v5] " kernel test robot
2026-05-13  6:12         ` kernel test robot
2026-05-13  5:11       ` [PATCH v4] " kernel test robot
2026-05-16  2:18 ` Claude review: " Claude Code Review Bot
2026-05-16  2:18 ` Claude Code Review Bot [this message]

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-patch1-20260508024744.6523-1-andrejhirata@usp.br \
    --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