Skip to contentSkip to conversation

ov9282: Fix Smatch errors

PATCH New Dave Stevenson 1 participant 4 messages Nov 28, 2022

Subsystems (3)
lore
Share & tools
lore

Dave Stevenson

author maintainer
#0 lore raw

cover ov9282: Fix Smatch errors

This serires fixes up smatch errors from the recent patches for ov9282.

Dave Stevenson (3):
media: i2c: ov9282: Fix missing documentation in structures
media: i2c: ov9282: Make common_regs_list static
media: i2c: ov9282: Add missing clk_disable_unprepare to error path

 drivers/media/i2c/ov9282.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/3 media: i2c: ov9282: Fix missing documentation in structures

Fix missing documentation entries for members of structures, as flagged by smatch.

---
 drivers/media/i2c/ov9282.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/media/i2c/ov9282.c +4 -0
index 4ee93daa23c6..a8ab523b6a40 100644
@@ -130,6 +130,7 @@ struct ov9282_reg_list {
  * @vblank_min: Minimum vertical blanking in lines
  * @vblank_max: Maximum vertical blanking in lines
  * @link_freq_idx: Link frequency index
+ * @crop: on-sensor cropping for this mode
  * @reg_list: Register list for sensor mode
  */
 struct ov9282_mode {
@@ -152,13 +153,16 @@ struct ov9282_mode {
  * @pad: Media pad. Only one pad supported
  * @reset_gpio: Sensor reset gpio
  * @inclk: Sensor input clock
+ * @supplies: Regulator supplies for the sensor
  * @ctrl_handler: V4L2 control handler
  * @link_freq_ctrl: Pointer to link frequency control
  * @hblank_ctrl: Pointer to horizontal blanking control
  * @vblank_ctrl: Pointer to vertical blanking control
  * @exp_ctrl: Pointer to exposure control
  * @again_ctrl: Pointer to analog gain control
+ * @pixel_rate: Pointer to pixel rate control
  * @vblank: Vertical blanking in lines
+ * @noncontinuous_clock: Selection of CSI2 noncontinuous clock mode
  * @cur_mode: Pointer to current selected sensor mode
  * @code: Mbus code currently selected
  * @mutex: Mutex for serializing sensor controls
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/3 media: i2c: ov9282: Make common_regs_list static

In reply to Dave Stevenson

common_regs_list is only used within this file, so should be static. Make it so.

Fixes 7195aabf8f8b ("media: i2c: ov9282: Split registers into common and mode specific")
---
 drivers/media/i2c/ov9282.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov9282.c +1 -1
index a8ab523b6a40..94e18da55a05 100644
@@ -268,7 +268,7 @@ static const struct ov9282_reg common_regs[] = {
 	{0x5a08, 0x84},
 };
 
-struct ov9282_reg_list common_regs_list = {
+static struct ov9282_reg_list common_regs_list = {
 	.num_of_regs = ARRAY_SIZE(common_regs),
 	.regs = common_regs,
 };
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH 3/3 media: i2c: ov9282: Add missing clk_disable_unprepare to error path

In reply to Dave Stevenson

If ov9282_power_on failed the I2C write, it returned without releasing clocks or regulators. Fix this.

Fixes 6f7def3d8a65 ("media: i2c: ov9282: Add selection for CSI2 clock mode")
---
 drivers/media/i2c/ov9282.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov9282.c +3 -1
index 94e18da55a05..38b8d33799d5 100644
@@ -1253,11 +1253,13 @@ static int ov9282_power_on(struct device *dev)
 					OV9282_GATED_CLOCK : 0);
 	if (ret) {
 		dev_err(ov9282->dev, "fail to write MIPI_CTRL00");
-		return ret;
+		goto error_clk;
 	}
 
 	return 0;
 
+error_clk:
+	clk_disable_unprepare(ov9282->inclk);
 error_reset:
 	gpiod_set_value_cansleep(ov9282->reset_gpio, 0);
 
Signature · 1 line
2.34.1