lede/target/linux/bcm27xx/patches-6.12/950-0968-media-i2c-imx477-Fix-lockdep-errors.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

51 lines
1.5 KiB
Diff

From e06fdaefd159410df88c6b3e2cf84a82a267dbb8 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 24 Apr 2025 17:04:19 +0100
Subject: [PATCH] media: i2c: imx477: Fix lockdep errors
imx477_get_format_code has a lockdep_assert_held test, however
the call paths from enum_mbus_code and enum_frame_size don't
lock the mutex before calling it.
Add in the relevant mutex locking.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/imx477.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/imx477.c
+++ b/drivers/media/i2c/imx477.c
@@ -1513,8 +1513,10 @@ static int imx477_enum_mbus_code(struct
if (code->index >= (ARRAY_SIZE(codes) / 4))
return -EINVAL;
+ mutex_lock(&imx477->mutex);
code->code = imx477_get_format_code(imx477,
codes[code->index * 4]);
+ mutex_unlock(&imx477->mutex);
} else {
if (code->index > 0)
return -EINVAL;
@@ -1530,6 +1532,7 @@ static int imx477_enum_frame_size(struct
struct v4l2_subdev_frame_size_enum *fse)
{
struct imx477 *imx477 = to_imx477(sd);
+ u32 code;
if (fse->pad >= NUM_PADS)
return -EINVAL;
@@ -1543,7 +1546,11 @@ static int imx477_enum_frame_size(struct
if (fse->index >= num_modes)
return -EINVAL;
- if (fse->code != imx477_get_format_code(imx477, fse->code))
+ mutex_lock(&imx477->mutex);
+ code = imx477_get_format_code(imx477, fse->code);
+ mutex_unlock(&imx477->mutex);
+
+ if (fse->code != code)
return -EINVAL;
fse->min_width = mode_list[fse->index].width;