linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Wen Yang <wen.yang99@zte.com.cn>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Yi Wang <wang.yi59@zte.com.cn>,
	Wingman Kwok <w-kwok2@ti.com>,
	Murali Karicheri <m-karicheri2@ti.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [v2] ethernet: ti: eliminate a bit of duplicate code in gbe_probe()
Date: Wed, 10 Apr 2019 09:56:34 +0200	[thread overview]
Message-ID: <4f5faeed-1618-63ee-f2f0-e9284b5a437e@web.de> (raw)
In-Reply-To: <1554864935-8299-1-git-send-email-wen.yang99@zte.com.cn>

> v2: Massaged changelog a bit

* How does this wording fit to the adjusted commit subject?

* Would it have been nicer to send this version as a direct reply
  to the previous update suggestion?


> @@ -3651,22 +3651,18 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
>  	if (ret)
>  		return ret;
>
> -	interfaces = of_get_child_by_name(node, "interfaces");
> -	if (!interfaces)
> -		dev_err(dev, "could not find interfaces\n");
> -

How do you think about to skip a bit of statements as a reaction for
such a null pointer?
https://elixir.bootlin.com/linux/v5.1-rc4/source/drivers/net/ethernet/ti/netcp_ethss.c#L3562


>  	ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device,
>  				gbe_dev->dma_chan_name, gbe_dev->tx_queue_id);
> -	if (ret) {
> -		of_node_put(interfaces);
> +	if (ret)
>  		return ret;
> -	}
>
>  	ret = netcp_txpipe_open(&gbe_dev->tx_pipe);
> -	if (ret) {
> -		of_node_put(interfaces);
> +	if (ret)
>  		return ret;
> -	}
> +
> +	interfaces = of_get_child_by_name(node, "interfaces");
> +	if (!interfaces)
> +		dev_err(dev, "could not find interfaces\n");
>
>  	/* Create network interfaces */
>  	INIT_LIST_HEAD(&gbe_dev->gbe_intf_head);

Can code like the following trigger corresponding software development concerns?

	for_each_child_of_node(interfaces, interface) {
…
	}
	of_node_put(interfaces);

	if (!gbe_dev->num_slaves)
		dev_warn(dev, "No network interface configured\n");


Regards,
Markus

  reply	other threads:[~2019-04-10  7:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10  2:55 [PATCH v2] net: ethernet: ti: eliminate a bit of duplicate code in gbe_probe() Wen Yang
2019-04-10  7:56 ` Markus Elfring [this message]
     [not found] <201904101639050539211@zte.com.cn>
2019-04-10  9:46 ` [v2] " Markus Elfring
     [not found] <201904101838229475340@zte.com.cn>
2019-04-10 11:35 ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f5faeed-1618-63ee-f2f0-e9284b5a437e@web.de \
    --to=markus.elfring@web.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=w-kwok2@ti.com \
    --cc=wang.yi59@zte.com.cn \
    --cc=wen.yang99@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).