diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-16 23:40:32 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-17 15:11:22 +0200 |
commit | 20ea6adbf199097c4f5f591ffee088340630dae4 (patch) | |
tree | d6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch | |
parent | bca05bd072180dc38ef740b37ded9572a6db1981 (diff) | |
download | upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2 upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip |
bcm27xx: add support for linux v5.15
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch b/target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch new file mode 100644 index 0000000000..c80323cdd1 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.15/950-0675-media-i2c-ov9281-Initialize-id_msb-to-zero-in-ov9281.patch @@ -0,0 +1,48 @@ +From 573172b7b51a5b955627bd3d0cde5b2d2c4f9441 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor <nathan@kernel.org> +Date: Mon, 31 Jan 2022 17:50:43 -0700 +Subject: [PATCH] media: i2c: ov9281: Initialize id_msb to zero in + ov9281_check_sensor_id() + +Clang warns: + + drivers/media/i2c/ov9281.c:1132:6: warning: variable 'id_msb' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] + if (!ret) + ^~~~ + drivers/media/i2c/ov9281.c:1135:9: note: uninitialized use occurs here + id |= (id_msb << 8); + ^~~~~~ + drivers/media/i2c/ov9281.c:1132:2: note: remove the 'if' if its condition is always true + if (!ret) + ^~~~~~~~~ + drivers/media/i2c/ov9281.c:1127:20: note: initialize the variable 'id_msb' to silence this warning + u32 id = 0, id_msb; + ^ + = 0 + 1 warning generated. + +If the first ov9281_read_reg() call fails, id_msb will be used +uninitialized. However, this warning does not actually matter in +practice because the value of id is not used when either call to +ov9281_read_reg() fails, as the boolean OR will short circuit due to the +ret condition being checked first. Regardless, it is not good to use +variables uninitialized so silence the warning by initializing id_msb to +0, as was done with id. + +Fixes: 20855581e0eb ("media: i2c: ov9281: Read chip ID via 2 reads") +Signed-off-by: Nathan Chancellor <nathan@kernel.org> +--- + drivers/media/i2c/ov9281.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/i2c/ov9281.c ++++ b/drivers/media/i2c/ov9281.c +@@ -1124,7 +1124,7 @@ static int ov9281_check_sensor_id(struct + struct i2c_client *client) + { + struct device *dev = &ov9281->client->dev; +- u32 id = 0, id_msb; ++ u32 id = 0, id_msb = 0; + int ret; + + ret = ov9281_read_reg(client, OV9281_REG_CHIP_ID + 1, |