diff mbox

[02/10] net: bcmgenet: free netdev on of_match_node() error

Message ID 1512242782-7134-3-git-send-email-arvind.yadav.cs@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arvind Yadav Dec. 2, 2017, 7:26 p.m. UTC
The change is to call free_netdev(), If of_match_node() will fail.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Doug Berger Dec. 5, 2017, 1:05 a.m. UTC | #1
On 12/02/2017 11:26 AM, Arvind Yadav wrote:
> The change is to call free_netdev(), If of_match_node() will fail.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index e2f1268..e0a8f79 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3363,8 +3363,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
>  
>  	if (dn) {
>  		of_id = of_match_node(bcmgenet_match, dn);
> -		if (!of_id)
> -			return -EINVAL;
> +		if (!of_id) {
> +			err = -EINVAL;
> +			goto err;
> +		}
>  	}
>  
>  	priv = netdev_priv(dev);
> 

I agree with the fix if you want to resubmit separate from this series
and please include a "fixes" tag.

Thanks,
    Doug
diff mbox

Patch

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index e2f1268..e0a8f79 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3363,8 +3363,10 @@  static int bcmgenet_probe(struct platform_device *pdev)
 
 	if (dn) {
 		of_id = of_match_node(bcmgenet_match, dn);
-		if (!of_id)
-			return -EINVAL;
+		if (!of_id) {
+			err = -EINVAL;
+			goto err;
+		}
 	}
 
 	priv = netdev_priv(dev);