From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: "Tantilov, Emil S" <emil.s.tantilov@intel.com>,
Simon Horman <horms@kernel.org>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<decot@google.com>, <willemb@google.com>,
<anthony.l.nguyen@intel.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<madhu.chittim@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net] idpf: check error for register_netdev() on init
Date: Fri, 14 Feb 2025 14:32:20 +0100 [thread overview]
Message-ID: <02b91659-83d2-482d-9b28-f814829b1005@intel.com> (raw)
In-Reply-To: <00ecb5e5-00b9-4c30-a29a-37c9f268b389@intel.com>
On 2/13/25 21:39, Tantilov, Emil S wrote:
> On 2/12/2025 10:21 AM, Simon Horman wrote:
>> On Mon, Feb 10, 2025 at 06:38:51PM -0800, Emil Tantilov wrote:
>>> Current init logic ignores the error code from register_netdev(),
>>> which will cause WARN_ON() on attempt to unregister it, if there was
>>> one,
>>> and there is no info for the user that the creation of the netdev
>>> failed.
>> Hi Emil,
>>
>> I'm wondering if we could reduce indentation and lines longer
>> than 80 characters in the above like this (completely untested!):
> I was mostly trying to focus on the fix itself, since this patch is -net
> bound. The >80 line came about from the introduction of the local netdev
> and it seemed cleaner to keep it in one line. I can just split the check
> as in the original code.
>
>>
>>
>> for (index = 0; index < adapter->max_vports; index++) {
>> struct idpf_vport_config *vport_config = adapter-
>> >vport_config[index];
>> struct net_device *netdev = adapter->netdevs[index];
>>
>> if (!netdev ||
>> test_bit(IDPF_VPORT_REG_NETDEV, vport_config->flags))
>> continue;
> Again, because its mainly to add the error checking I am not sure if its
> OK to re-shuffle the logic.
>
>>
>> err = register_netdev(netdev);
>> if (err) {
>> dev_err(&pdev->dev, "failed to register netdev for vport
>> %d: %pe\n",
>> index, ERR_PTR(err));
>> continue;
>> }
>> set_bit(IDPF_VPORT_REG_NETDEV, vport_config->flags);
>> }
>
> Don't mind re-spinning (and testing) v2 with the proposed change, if
> it's not infringing on the guidelines for submission to -net.
>
> Thanks,
> Emil
Emil, you are right that we generally don't want to do refactors on -net
submissions. In this particular case your code was just replacing the
body of the loop. Simon's snippet did the same, just with less
indentation.
The "early return" (or "continue") style is better, also in this case.
next prev parent reply other threads:[~2025-02-14 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 2:38 [Intel-wired-lan] [PATCH iwl-net] idpf: check error for register_netdev() on init Emil Tantilov
2025-02-12 18:21 ` Simon Horman
2025-02-13 20:39 ` Tantilov, Emil S
2025-02-14 13:32 ` Przemek Kitszel [this message]
2025-02-16 9:36 ` Simon Horman
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=02b91659-83d2-482d-9b28-f814829b1005@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=madhu.chittim@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/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