diff mbox series

[v2,2/2] media: ccs: Fail the probe on CCS static data parser failure

Message ID 453d8e099752c5216c465dfd71429e9e0e53d1fd.1734010609.git.mehdi.djait@linux.intel.com (mailing list archive)
State New
Headers show
Series [v2,1/2] media: ccs: Print a warning on CCS static data parser failure | expand

Commit Message

Mehdi Djait Dec. 12, 2024, 1:40 p.m. UTC
No need to continue probing when the CCS static data parser fails. Improve this
by checking the return value and correctly exiting on failure.

Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
---
v1 -> v2:
- no changes: this patch is introduced in the v2

 drivers/media/i2c/ccs/ccs-core.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index f3af8aed1485..b3fd7f75bf62 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -3756,9 +3756,11 @@  static int ccs_probe(struct i2c_client *client)
 
 	rval = request_firmware(&fw, filename, &client->dev);
 	if (!rval) {
-		ccs_data_parse(&sensor->sdata, fw->data, fw->size, &client->dev,
-			       true);
+		rval = ccs_data_parse(&sensor->sdata, fw->data, fw->size,
+				      &client->dev, true);
 		release_firmware(fw);
+		if (rval)
+			goto out_power_off;
 	}
 
 	if (!(ccsdev->flags & CCS_DEVICE_FLAG_IS_SMIA) ||
@@ -3772,9 +3774,11 @@  static int ccs_probe(struct i2c_client *client)
 
 		rval = request_firmware(&fw, filename, &client->dev);
 		if (!rval) {
-			ccs_data_parse(&sensor->mdata, fw->data, fw->size,
-				       &client->dev, true);
+			rval = ccs_data_parse(&sensor->mdata, fw->data,
+					      fw->size, &client->dev, true);
 			release_firmware(fw);
+			if (rval)
+				goto out_release_sdata;
 		}
 	}