From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/rockchip: cdn-dp: Support handle lane info without extcon Date: Thu, 05 Mar 2026 13:38:00 +1000 Message-ID: In-Reply-To: <20260304094152.92-7-kernel@airkyi.com> References: <20260304094152.92-1-kernel@airkyi.com> <20260304094152.92-7-kernel@airkyi.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review Makes extcon optional in the CDN-DP driver. When no extcon, lane info comes from PHY bus width. **Issue (medium): Logic change in probe may be incorrect:** ```c - if (IS_ERR(extcon) || IS_ERR(phy)) + if (IS_ERR(phy) || PTR_ERR(extcon) != -ENODEV) continue; ``` The new condition `PTR_ERR(extcon) != -ENODEV` is evaluated even when `extcon` is a valid (non-error) pointer. When `extcon` is valid, `PTR_ERR(extcon)` returns a garbage value that is almost certainly not `-ENODEV`, so the condition becomes true and the port is **skipped**. This means when both extcon and phy are valid, the port would be skipped -- which breaks the existing extcon path. The correct logic should be: ```c if (IS_ERR(phy) || (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV)) continue; ``` Wait, let me re-read. The original code was `if (IS_ERR(extcon) || IS_ERR(phy)) continue;` -- skip if either is an error. The new intent is: skip if phy is error, OR if extcon is an error that is NOT -ENODEV (i.e., -ENODEV is acceptable because we can work without extcon). But the current code `PTR_ERR(extcon) != -ENODEV` is true for both valid pointers and non-ENODEV errors. Actually... `PTR_ERR()` on a valid pointer gives a nonsensical result, and that won't equal `-ENODEV`, so the `continue` would fire and the port gets skipped. **This is a bug** that would break existing boards that have both valid extcon and phy. Let me verify by checking if there's an `IS_ERR(extcon)` guard. Looking again at the code flow more carefully: there's an earlier check `if (PTR_ERR(extcon) == -EPROBE_DEFER || PTR_ERR(phy) == -EPROBE_DEFER) return -EPROBE_DEFER;`. But `PTR_ERR` on valid pointers is still undefined/garbage. Actually, looking at the full context: the EPROBE_DEFER check before this already returns for that case. So at this point, extcon is either valid or an error other than EPROBE_DEFER, and phy is valid or an error other than EPROBE_DEFER. For the old extcon boards: `extcon` is valid, `phy` is valid. `IS_ERR(phy)` = false. `PTR_ERR(extcon)` on a valid pointer won't be -ENODEV. So the `continue` fires. **This breaks existing boards.** This needs to be: ```c if (IS_ERR(phy) || (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV)) continue; ``` --- Generated by Claude Code Patch Reviewer