diff mbox series

[04/24] soc: mediatek: pwrap: add missing check on rstc

Message ID 20190323211612.860-5-fparent@baylibre.com (mailing list archive)
State Not Applicable
Headers show
Series arm64: mediatek: add support for Pumpkin MT8516 board | expand

Commit Message

Fabien Parent March 23, 2019, 9:15 p.m. UTC
The variable rstc is set only when the SoC PWRAP have the
PWRAP_CAP_RESET capability. Check whether rstc is set before
using it to avoid errors.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Matthias Brugger April 12, 2019, 5:44 p.m. UTC | #1
On 23/03/2019 22:15, Fabien Parent wrote:
> The variable rstc is set only when the SoC PWRAP have the
> PWRAP_CAP_RESET capability. Check whether rstc is set before
> using it to avoid errors.
> 
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> ---
>  drivers/soc/mediatek/mtk-pmic-wrap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied to v5.1-next/soc

Thanks!

> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 8236a6c87e19..b3ba2301f569 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -1478,7 +1478,8 @@ static int pwrap_init(struct pmic_wrapper *wrp)
>  {
>  	int ret;
>  
> -	reset_control_reset(wrp->rstc);
> +	if (wrp->rstc)
> +		reset_control_reset(wrp->rstc);
>  	if (wrp->rstc_bridge)
>  		reset_control_reset(wrp->rstc_bridge);
>  
>
diff mbox series

Patch

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 8236a6c87e19..b3ba2301f569 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1478,7 +1478,8 @@  static int pwrap_init(struct pmic_wrapper *wrp)
 {
 	int ret;
 
-	reset_control_reset(wrp->rstc);
+	if (wrp->rstc)
+		reset_control_reset(wrp->rstc);
 	if (wrp->rstc_bridge)
 		reset_control_reset(wrp->rstc_bridge);