diff mbox

[-next] dmaengine: qcom_hidma: fix return value check in hidma_mgmt_of_populate_channels()

Message ID 1467807549-31813-1-git-send-email-weiyj_lk@163.com (mailing list archive)
State Accepted
Headers show

Commit Message

weiyj_lk@163.com July 6, 2016, 12:19 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function platform_device_register_full()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/dma/qcom/hidma_mgmt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sinan Kaya July 6, 2016, 8:20 p.m. UTC | #1
On 2016-07-06 15:19, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function platform_device_register_full()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/dma/qcom/hidma_mgmt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/qcom/hidma_mgmt.c 
> b/drivers/dma/qcom/hidma_mgmt.c
> index c0e3653..6416ded 100644
> --- a/drivers/dma/qcom/hidma_mgmt.c
> +++ b/drivers/dma/qcom/hidma_mgmt.c
> @@ -371,8 +371,8 @@ static int __init
> hidma_mgmt_of_populate_channels(struct device_node *np)
>  		pdevinfo.size_data = 0;
>  		pdevinfo.dma_mask = DMA_BIT_MASK(64);
>  		new_pdev = platform_device_register_full(&pdevinfo);
> -		if (!new_pdev) {
> -			ret = -ENODEV;
> +		if (IS_ERR(new_pdev)) {
> +			ret = PTR_ERR(new_pdev);
>  			goto out;
>  		}
>  		of_dma_configure(&new_pdev->dev, child);


Looks good to me.
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul July 12, 2016, 4:45 a.m. UTC | #2
On Wed, Jul 06, 2016 at 12:19:09PM +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function platform_device_register_full()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().

Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
index c0e3653..6416ded 100644
--- a/drivers/dma/qcom/hidma_mgmt.c
+++ b/drivers/dma/qcom/hidma_mgmt.c
@@ -371,8 +371,8 @@  static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
 		pdevinfo.size_data = 0;
 		pdevinfo.dma_mask = DMA_BIT_MASK(64);
 		new_pdev = platform_device_register_full(&pdevinfo);
-		if (!new_pdev) {
-			ret = -ENODEV;
+		if (IS_ERR(new_pdev)) {
+			ret = PTR_ERR(new_pdev);
 			goto out;
 		}
 		of_dma_configure(&new_pdev->dev, child);