From: Pengyu Luo <mitltlatltl@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Martin Kepplinger-Novakovic <martink@posteo.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Pengyu Luo <mitltlatltl@gmail.com>
Subject: [PATCH 1/2] media: hi846: fix hi846_write_reg_16 handling
Date: Wed, 29 Apr 2026 15:03:50 +0800 [thread overview]
Message-ID: <20260429070351.1307204-2-mitltlatltl@gmail.com> (raw)
In-Reply-To: <20260429070351.1307204-1-mitltlatltl@gmail.com>
hi846_write_reg_16() does not clear a positive *err value on success.
pm_runtime_get_if_in_use() returns a positive value when the device
is already in use. When hi846_set_ctrl() passes &ret holding this
positive value) to hi846_write_reg_16(), the function returns with ret
as is, the positive value propagates back as a return code, which
callers interpret as an error.
Fix this by resetting *err to 0 only when it is positive.
Fixes: 04fc06f6dc15 ("media: hi846: fix usage of pm_runtime_get_if_in_use()")
Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
---
drivers/media/i2c/hi846.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c
index a3f77b8434ca..09c109f3fba9 100644
--- a/drivers/media/i2c/hi846.c
+++ b/drivers/media/i2c/hi846.c
@@ -1270,6 +1270,8 @@ static void hi846_write_reg_16(struct hi846 *hi846, u16 reg, u16 val, int *err)
if (*err < 0)
return;
+ else
+ *err = 0;
put_unaligned_be16(reg, buf);
put_unaligned_be16(val, buf + 2);
--
2.54.0
next prev parent reply other threads:[~2026-04-29 7:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 7:03 [PATCH 0/2] fix and improve for Hi846 Pengyu Luo
2026-04-29 7:03 ` Pengyu Luo [this message]
2026-04-29 7:44 ` [PATCH 1/2] media: hi846: fix hi846_write_reg_16 handling Sakari Ailus
2026-04-29 7:03 ` [PATCH 2/2] media: hi846: Add 6MP and 8MP modes support Pengyu Luo
2026-04-29 9:01 ` Sakari Ailus
2026-04-30 16:18 ` Pengyu Luo
2026-04-30 20:39 ` Sakari Ailus
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=20260429070351.1307204-2-mitltlatltl@gmail.com \
--to=mitltlatltl@gmail.com \
--cc=hverkuil@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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