diff mbox series

[8/9] media: i2c: mt9m114: goto proper error path

Message ID 6e2b3d5971905c1cf63184e7c3cd269c10151bb7.1696586632.git.hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series media: fix smatch warnings | expand

Commit Message

Hans Verkuil Oct. 6, 2023, 10:08 a.m. UTC
In two places the probe function returns instead of going
to the correct goto label.

This fixes this smatch warning:

drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9m114.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Oct. 6, 2023, 3:18 p.m. UTC | #1
Hi Hans,

Thank you for the patch.

On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
> In two places the probe function returns instead of going
> to the correct goto label.
> 
> This fixes this smatch warning:
> 
> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I've already submitted
https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com

> ---
>  drivers/media/i2c/mt9m114.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
> index dae675e52390..ac19078ceda3 100644
> --- a/drivers/media/i2c/mt9m114.c
> +++ b/drivers/media/i2c/mt9m114.c
> @@ -2367,7 +2367,7 @@ static int mt9m114_probe(struct i2c_client *client)
>  
>  	ret = mt9m114_clk_init(sensor);
>  	if (ret)
> -		return ret;
> +		goto error_ep_free;
>  
>  	/*
>  	 * Identify the sensor. The driver supports runtime PM, but needs to
> @@ -2378,7 +2378,7 @@ static int mt9m114_probe(struct i2c_client *client)
>  	ret = mt9m114_power_on(sensor);
>  	if (ret < 0) {
>  		dev_err_probe(dev, ret, "Could not power on the device\n");
> -		return ret;
> +		goto error_ep_free;
>  	}
>  
>  	ret = mt9m114_identify(sensor);
Hans Verkuil Oct. 10, 2023, 7:24 a.m. UTC | #2
Hi Laurent,

On 06/10/2023 17:18, Laurent Pinchart wrote:
> Hi Hans,
> 
> Thank you for the patch.
> 
> On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
>> In two places the probe function returns instead of going
>> to the correct goto label.
>>
>> This fixes this smatch warning:
>>
>> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
>>
>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I've already submitted
> https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com

Is it OK if I pick up your patch for this issue? I plan to pick up at least part
of this series tomorrow in order to cut down on the number of reported smatch
warnings.

Regards,

	Hans

> 
>> ---
>>  drivers/media/i2c/mt9m114.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
>> index dae675e52390..ac19078ceda3 100644
>> --- a/drivers/media/i2c/mt9m114.c
>> +++ b/drivers/media/i2c/mt9m114.c
>> @@ -2367,7 +2367,7 @@ static int mt9m114_probe(struct i2c_client *client)
>>  
>>  	ret = mt9m114_clk_init(sensor);
>>  	if (ret)
>> -		return ret;
>> +		goto error_ep_free;
>>  
>>  	/*
>>  	 * Identify the sensor. The driver supports runtime PM, but needs to
>> @@ -2378,7 +2378,7 @@ static int mt9m114_probe(struct i2c_client *client)
>>  	ret = mt9m114_power_on(sensor);
>>  	if (ret < 0) {
>>  		dev_err_probe(dev, ret, "Could not power on the device\n");
>> -		return ret;
>> +		goto error_ep_free;
>>  	}
>>  
>>  	ret = mt9m114_identify(sensor);
>
Laurent Pinchart Oct. 10, 2023, 7:58 a.m. UTC | #3
Hi Hans,

On Tue, Oct 10, 2023 at 09:24:10AM +0200, Hans Verkuil wrote:
> On 06/10/2023 17:18, Laurent Pinchart wrote:
> > On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
> >> In two places the probe function returns instead of going
> >> to the correct goto label.
> >>
> >> This fixes this smatch warning:
> >>
> >> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
> >>
> >> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> >> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > I've already submitted
> > https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com
> 
> Is it OK if I pick up your patch for this issue? I plan to pick up at least part
> of this series tomorrow in order to cut down on the number of reported smatch
> warnings.

Fine with me. Please update the Fixes: line, as the commit ID has
changed due to the recent rebase. And this is a good occasion to test
your scripts and make sure they catch this :-)

> >> ---
> >>  drivers/media/i2c/mt9m114.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
> >> index dae675e52390..ac19078ceda3 100644
> >> --- a/drivers/media/i2c/mt9m114.c
> >> +++ b/drivers/media/i2c/mt9m114.c
> >> @@ -2367,7 +2367,7 @@ static int mt9m114_probe(struct i2c_client *client)
> >>  
> >>  	ret = mt9m114_clk_init(sensor);
> >>  	if (ret)
> >> -		return ret;
> >> +		goto error_ep_free;
> >>  
> >>  	/*
> >>  	 * Identify the sensor. The driver supports runtime PM, but needs to
> >> @@ -2378,7 +2378,7 @@ static int mt9m114_probe(struct i2c_client *client)
> >>  	ret = mt9m114_power_on(sensor);
> >>  	if (ret < 0) {
> >>  		dev_err_probe(dev, ret, "Could not power on the device\n");
> >> -		return ret;
> >> +		goto error_ep_free;
> >>  	}
> >>  
> >>  	ret = mt9m114_identify(sensor);
Sakari Ailus Oct. 10, 2023, 7:59 a.m. UTC | #4
Hi Hans,

On Tue, Oct 10, 2023 at 09:24:10AM +0200, Hans Verkuil wrote:
> Hi Laurent,
> 
> On 06/10/2023 17:18, Laurent Pinchart wrote:
> > Hi Hans,
> > 
> > Thank you for the patch.
> > 
> > On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
> >> In two places the probe function returns instead of going
> >> to the correct goto label.
> >>
> >> This fixes this smatch warning:
> >>
> >> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
> >>
> >> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> >> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > I've already submitted
> > https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com
> 
> Is it OK if I pick up your patch for this issue? I plan to pick up at least part
> of this series tomorrow in order to cut down on the number of reported smatch
> warnings.

I've got it in my tree and I intend to send a PR by tomorrow (there's an
issue also in the CCS driver).
Hans Verkuil Oct. 10, 2023, 8:06 a.m. UTC | #5
On 10/10/23 09:59, Sakari Ailus wrote:
> Hi Hans,
> 
> On Tue, Oct 10, 2023 at 09:24:10AM +0200, Hans Verkuil wrote:
>> Hi Laurent,
>>
>> On 06/10/2023 17:18, Laurent Pinchart wrote:
>>> Hi Hans,
>>>
>>> Thank you for the patch.
>>>
>>> On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
>>>> In two places the probe function returns instead of going
>>>> to the correct goto label.
>>>>
>>>> This fixes this smatch warning:
>>>>
>>>> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
>>>>
>>>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>>>> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>>
>>> I've already submitted
>>> https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com
>>
>> Is it OK if I pick up your patch for this issue? I plan to pick up at least part
>> of this series tomorrow in order to cut down on the number of reported smatch
>> warnings.
> 
> I've got it in my tree and I intend to send a PR by tomorrow (there's an
> issue also in the CCS driver).
> 

OK, then I leave this to you, Sakari.

The two patches you reviewed (2/9 and 7/9), can I commit those or do you plan
to make those part of your PR? I don't care either way, as long as we don't
duplicate work...

Regards,

	Hans
Sakari Ailus Oct. 10, 2023, 3:03 p.m. UTC | #6
Hi Hans,

On Tue, Oct 10, 2023 at 10:06:38AM +0200, Hans Verkuil wrote:
> On 10/10/23 09:59, Sakari Ailus wrote:
> > Hi Hans,
> > 
> > On Tue, Oct 10, 2023 at 09:24:10AM +0200, Hans Verkuil wrote:
> >> Hi Laurent,
> >>
> >> On 06/10/2023 17:18, Laurent Pinchart wrote:
> >>> Hi Hans,
> >>>
> >>> Thank you for the patch.
> >>>
> >>> On Fri, Oct 06, 2023 at 12:08:49PM +0200, Hans Verkuil wrote:
> >>>> In two places the probe function returns instead of going
> >>>> to the correct goto label.
> >>>>
> >>>> This fixes this smatch warning:
> >>>>
> >>>> drivers/media/i2c/mt9m114.c:2381 mt9m114_probe() warn: missing unwind goto?
> >>>>
> >>>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> >>>> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>>
> >>> I've already submitted
> >>> https://lore.kernel.org/linux-media/20231003192043.27690-1-laurent.pinchart@ideasonboard.com
> >>
> >> Is it OK if I pick up your patch for this issue? I plan to pick up at least part
> >> of this series tomorrow in order to cut down on the number of reported smatch
> >> warnings.
> > 
> > I've got it in my tree and I intend to send a PR by tomorrow (there's an
> > issue also in the CCS driver).
> > 
> 
> OK, then I leave this to you, Sakari.
> 
> The two patches you reviewed (2/9 and 7/9), can I commit those or do you plan
> to make those part of your PR? I don't care either way, as long as we don't
> duplicate work...

You already have them as part of your set so please take them.

I think I've already reviewed them, too.
diff mbox series

Patch

diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
index dae675e52390..ac19078ceda3 100644
--- a/drivers/media/i2c/mt9m114.c
+++ b/drivers/media/i2c/mt9m114.c
@@ -2367,7 +2367,7 @@  static int mt9m114_probe(struct i2c_client *client)
 
 	ret = mt9m114_clk_init(sensor);
 	if (ret)
-		return ret;
+		goto error_ep_free;
 
 	/*
 	 * Identify the sensor. The driver supports runtime PM, but needs to
@@ -2378,7 +2378,7 @@  static int mt9m114_probe(struct i2c_client *client)
 	ret = mt9m114_power_on(sensor);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "Could not power on the device\n");
-		return ret;
+		goto error_ep_free;
 	}
 
 	ret = mt9m114_identify(sensor);