Skip to contentSkip to conversation

Compiler warning fixes

PATCH In review Sakari Ailus 2 participants 4 messages Aug 1, 2023

Subsystems (3)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

cover Compiler warning fixes

Hi folks,

These two little patches address a couple of compiler and smatch warnings.

Sakari Ailus (2):
media: ccs-pll: Initialise best_div to avoid a compiler warning
media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler
warning

 drivers/media/i2c/ccs-pll.c              | 2 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/2 media: ccs-pll: Initialise best_div to avoid a compiler warning

Initialise best_div local variable to avoid a compiler warning. The warning was harmless though.

---
 drivers/media/i2c/ccs-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs-pll.c +1 -1
index fcc39360cc50..cf8858cb13d4 100644
@@ -296,7 +296,7 @@ __ccs_pll_calculate_vt_tree(struct device *dev,
 	struct ccs_pll_branch_fr *pll_fr = &pll->vt_fr;
 	struct ccs_pll_branch_bk *pll_bk = &pll->vt_bk;
 	u32 more_mul;
-	u16 best_pix_div = SHRT_MAX >> 1, best_div;
+	u16 best_pix_div = SHRT_MAX >> 1, best_div = lim_bk->max_sys_clk_div;
 	u16 vt_div, min_sys_div, max_sys_div, sys_div;
 
 	pll_fr->pll_ip_clk_freq_hz =
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/2 media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning

In reply to Sakari Ailus

Initialise timing struct in cio2_hw_init() to zero in order to avoid a compiler warning. The warning was a false positive.

---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -1
index 4ebab0a95f35..8df0304c991e 100644
@@ -355,7 +355,7 @@ static int cio2_hw_init(struct cio2_device *cio2, struct cio2_queue *q)
 	void __iomem *const base = cio2->base;
 	u8 lanes, csi2bus = q->csi2.port;
 	u8 sensor_vc = SENSOR_VIR_CH_DFLT;
-	struct cio2_csi2_timing timing;
+	struct cio2_csi2_timing timing = { 0 };
 	int i, r;
 
 	fmt = cio2_find_format(NULL, &q->subdev_fmt.code);
Signature · 1 line
2.39.2
#3 lore raw
In reply to Sakari Ailus

Hi Sakari,

Quoted 4 lines · Sakari Ailus

Hi folks,

These two little patches address a couple of compiler and smatch warnings.

Quoted 9 lines

Sakari Ailus (2):
media: ccs-pll: Initialise best_div to avoid a compiler warning
media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler
warning

 drivers/media/i2c/ccs-pll.c              | 2 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Much appreciated! I've merged these two patches.

I'm left with one more ccs smatch warning in the daily build:

drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address of NULL pointer 'rules'

While 'rules' shouldn't be NULL, it is too difficult for smatch (or me, for that matter) to see that. And I am also wondering if a NULL check wouldn't make the code more robust in case of broken rules.

Regards,

Hans