Skip to contentSkip to conversation

media: ccs: Print a warning on CCS static data parse failure

PATCH Superseded Mehdi Djait 2 participants 3 messages Dec 9, 2024 – Dec 10, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: ccs: Print a warning on CCS static data parse failure

ccs_data_parse() return value is not propagated up to the probe function, making it difficult on static data parse Failure. Improve this by printing a warning when ccs_data_parse() fails.

---
 drivers/media/i2c/ccs/ccs-data.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/i2c/ccs/ccs-data.c +1 -0
index c40d859166dd..f64fbfa1c7b5 100644
@@ -976,6 +976,7 @@ int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data,
 out_cleanup:
 	kvfree(bin.base);
 	memset(ccsdata, 0, sizeof(*ccsdata));
+	dev_warn(dev, "failed to parse CCS static data file: %d\n", rval);
 
 	return rval;
 }
Signature · 1 line
2.47.1
maintainer
#1 lore raw

Hi Mehdi,

Quoted 2 lines · Mehdi Djait

ccs_data_parse() return value is not propagated up to the probe function, making it difficult on static data parse Failure.

Could you reword this by referring to the CCS static data library only? This would fit better for the CCS tools where the patch will also be imported to.

<URL:https://github.com/MIPI-Alliance/ccs-tools>

I also wonder if the CCS driver should actually fail probe if parsing
fails: this is a very likely problem and quitting there would be appropriate IMO. Not every device might need one, so it should be just based on parser failure.

Thanks.

Quoted 12 lines

Improve this by printing a warning when ccs_data_parse() fails.

---
 drivers/media/i2c/ccs/ccs-data.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/i2c/ccs/ccs-data.c +0 -0
index c40d859166dd..f64fbfa1c7b5 100644

drivers/media/i2c/ccs/ccs-data.c int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data, · line 979

Quoted 4 lines
drivers/media/i2c/ccs/ccs-data.c +1 -0
@@ -976,6 +976,7 @@ int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data,
 out_cleanup:
 	kvfree(bin.base);
 	memset(ccsdata, 0, sizeof(*ccsdata));
+	dev_warn(dev, "failed to parse CCS static data file: %d\n", rval);

s/ file//

Quoted 3 lines
drivers/media/i2c/ccs/ccs-data.c +0 -0
 	return rval;
 }
Signature · 3 lines
Kind regards,

Sakari Ailus
#2 lore raw

Hi Sakari,

Quoted 10 lines · Sakari Ailus

Hi Mehdi,

Quoted 2 lines · Mehdi Djait

ccs_data_parse() return value is not propagated up to the probe function, making it difficult on static data parse Failure.

Could you reword this by referring to the CCS static data library only? This would fit better for the CCS tools where the patch will also be imported to.

Quoted 6 lines

<URL:https://github.com/MIPI-Alliance/ccs-tools>

I also wonder if the CCS driver should actually fail probe if parsing
fails: this is a very likely problem and quitting there would be appropriate IMO. Not every device might need one, so it should be just based on parser failure.

I would also think there is no point to continue probing if parsing fails. I will send a v2 for this.

--
Kind Regards
Mehdi Djait