LinuxTV Patchwork media: mt312: fix a missing check of mt312 reset

login
register
mail settings
Submitter Kangjie Lu
Date Dec. 21, 2018, 7:07 a.m.
Message ID <20181221070722.60234-1-kjlu@umn.edu>
Download mbox | patch
Permalink /patch/53614/
State Accepted
Delegated to: Sean Young
Headers show

Comments

Kangjie Lu - Dec. 21, 2018, 7:07 a.m.
mt312_reset() may fail. Although it is called in the end of
mt312_set_frontend(), we better check its status and return its error
code upstream instead of 0.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/dvb-frontends/mt312.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Matthias Schwarzott - Dec. 24, 2018, 11:23 a.m.
Am 21.12.18 um 08:07 schrieb Kangjie Lu:
> mt312_reset() may fail. Although it is called in the end of
> mt312_set_frontend(), we better check its status and return its error
> code upstream instead of 0.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Thanks for submitting this patch. It looks correct.

Reviewed-by: Matthias Schwarzott <zzam@gentoo.org>

> ---
>  drivers/media/dvb-frontends/mt312.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c
> index 03e74a729168..bfbb879469f2 100644
> --- a/drivers/media/dvb-frontends/mt312.c
> +++ b/drivers/media/dvb-frontends/mt312.c
> @@ -645,7 +645,9 @@ static int mt312_set_frontend(struct dvb_frontend *fe)
>  	if (ret < 0)
>  		return ret;
>  
> -	mt312_reset(state, 0);
> +	ret = mt312_reset(state, 0);
> +	if (ret < 0)
> +		return ret;
>  
>  	return 0;
>  }
>

Patch

diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c
index 03e74a729168..bfbb879469f2 100644
--- a/drivers/media/dvb-frontends/mt312.c
+++ b/drivers/media/dvb-frontends/mt312.c
@@ -645,7 +645,9 @@  static int mt312_set_frontend(struct dvb_frontend *fe)
 	if (ret < 0)
 		return ret;
 
-	mt312_reset(state, 0);
+	ret = mt312_reset(state, 0);
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }

Privacy Policy