On Thu Dec 12 14:40:04 2024 +0100, Mehdi Djait wrote:
> 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.dj...@linux.intel.com>
> Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+hua...@kernel.org>

Patch committed.

Thanks,
Mauro Carvalho Chehab

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

---

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index cb21df46bab1..2cdab2f3d9dc 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -3335,9 +3335,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) ||
@@ -3351,9 +3353,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;
                }
        }
 

Reply via email to