lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171017181810.smvocm63gr2qygw6@art_vandelay>
Date:   Tue, 17 Oct 2017 14:18:10 -0400
From:   Sean Paul <seanpaul@...omium.org>
To:     Jeffy Chen <jeffy.chen@...k-chips.com>
Cc:     linux-kernel@...r.kernel.org, dmitry.torokhov@...il.com,
        heiko@...ech.de, briannorris@...omium.org, rjw@...ysocki.net,
        dianders@...omium.org, tfiga@...omium.org, broonie@...nel.org,
        seanpaul@...omium.org, Mark Yao <mark.yao@...k-chips.com>,
        dri-devel@...ts.freedesktop.org,
        linux-rockchip@...ts.infradead.org,
        David Airlie <airlied@...ux.ie>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC PATCH v4 5/8] drm/rockchip: inno_hdmi: Fix error handling
 path

On Tue, Oct 17, 2017 at 06:16:21PM +0800, Jeffy Chen wrote:
> Add missing error handling in bind().
> 
> Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
> Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
> ---
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/gpu/drm/rockchip/inno_hdmi.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
> index ee584d87111f..9c258b05dfa5 100644
> --- a/drivers/gpu/drm/rockchip/inno_hdmi.c
> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
> @@ -851,8 +851,10 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0)
> -		return irq;
> +	if (irq < 0) {
> +		ret = irq;
> +		goto err_disable_clk;
> +	}
>  
>  	inno_hdmi_reset(hdmi);
>  
> @@ -860,7 +862,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
>  	if (IS_ERR(hdmi->ddc)) {
>  		ret = PTR_ERR(hdmi->ddc);
>  		hdmi->ddc = NULL;
> -		return ret;
> +		goto err_disable_clk;
>  	}
>  
>  	/*
> @@ -874,7 +876,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
>  
>  	ret = inno_hdmi_register(drm, hdmi);
>  	if (ret)
> -		return ret;
> +		goto err_put_adapter;
>  
>  	dev_set_drvdata(dev, hdmi);
>  
> @@ -884,7 +886,17 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
>  	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
>  					inno_hdmi_irq, IRQF_SHARED,
>  					dev_name(dev), hdmi);
> +	if (ret < 0)
> +		goto err_cleanup_hdmi;
>  
> +	return 0;
> +err_cleanup_hdmi:
> +	drm_connector_cleanup(&hdmi->connector);
> +	drm_encoder_cleanup(&hdmi->encoder);

Same question regarding cleanup vs destroy.

> +err_put_adapter:
> +	i2c_put_adapter(hdmi->ddc);
> +err_disable_clk:
> +	clk_disable_unprepare(hdmi->pclk);

I also noticed the order of these two functions is reversed in unbind(). Can you
please update the order to match?

Sean

>  	return ret;
>  }
>  
> -- 
> 2.11.0
> 
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ