From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: video: fbdev: omapfb: Add missing error check for clk_get()
Date: Wed, 11 Mar 2026 13:28:19 +1000 [thread overview]
Message-ID: <review-patch1-20260310085625.2648545-1-nichen@iscas.ac.cn> (raw)
In-Reply-To: <20260310085625.2648545-1-nichen@iscas.ac.cn>
Patch Review
**The IS_ERR check is correct and needed.** The `clk_get()` call at line 952 is indeed unchecked, and adding the check is the right thing to do:
```c
hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
+ if (IS_ERR(hwa742.sys_ck))
+ return PTR_ERR(hwa742.sys_ck);
```
This is fine — at this point in `hwa742_init()`, no resources have been acquired yet (the `int_ctrl->init()` and `extif->init()` calls happen later), so returning directly is correct rather than going through the error unwind labels.
**The `clk_put()` in `err1` is problematic.** Looking at the error paths:
```c
err1:
+ clk_put(hwa742.sys_ck);
return r;
```
The `err1` label is reached from line 956-957:
```c
if ((r = hwa742.int_ctrl->init(fbdev, 1, req_vram)) < 0)
goto err1;
```
And also falls through from `err2`:
```c
err2:
hwa742.int_ctrl->cleanup();
err1:
+ clk_put(hwa742.sys_ck);
return r;
```
Since `clk_get()` succeeded if we reach any of these labels (the IS_ERR check returns early), calling `clk_put()` at `err1` is correct. Similarly, `err3` and `err4` flow through `err2` → `err1`, so all error paths will now properly release the clock. This is actually fine.
**The `clk_put()` in `hwa742_cleanup()` is correct:**
```c
clk_disable_unprepare(hwa742.sys_ck);
+ clk_put(hwa742.sys_ck);
```
The clock needs to be released on driver cleanup. The ordering (disable/unprepare first, then put) is correct.
**Minor observation:** This driver uses the legacy `clk_get(NULL, ...)` / `clk_put()` API rather than `devm_clk_get()`. Converting to the managed API would be a further improvement but is outside the scope of this fix and would be a separate cleanup patch.
**Overall:** The patch is correct and addresses a real bug. The error handling and cleanup are properly structured.
Reviewed-by looks appropriate for this patch.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-03-11 3:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 8:56 [PATCH] video: fbdev: omapfb: Add missing error check for clk_get() Chen Ni
2026-03-10 17:42 ` Helge Deller
2026-03-11 3:28 ` Claude review: " Claude Code Review Bot
2026-03-11 3:28 ` 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-20260310085625.2648545-1-nichen@iscas.ac.cn \
--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