netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Nikita Kiryushin <kiryushin@ancud.ru>
Cc: Sudarsana Kalluru <skalluru@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH net-next] bnx2x: remove redundant NULL-pointer check
Date: Sat, 13 Jul 2024 19:29:28 +0100	[thread overview]
Message-ID: <20240713182928.GA8432@kernel.org> (raw)
In-Reply-To: <20240712185431.81805-1-kiryushin@ancud.ru>

On Fri, Jul 12, 2024 at 09:54:31PM +0300, Nikita Kiryushin wrote:
> bnx2x_get_vf_config() contains NULL-pointer checks for
> mac_obj and vlan_obj.
> 
> The fields checked are assigned to (after macro expansions):
> 
> mac_obj = &((vf)->vfqs[0].mac_obj);
> vlan_obj = &((vf)->vfqs[0].vlan_obj);
> 
> It is impossible to get NULL for those

Hi Nikita,

I agree with the above.

> (and (vf)->vfqs was
> checked earlier in bnx2x_vf_op_prep).

But, FWIIW, I don't think the test on the two lines above is relevant.

bnx2x_vf_op_prep does, conditionally, check that (vf)->vfqs is not NULL.
But if (vf)->vfqs was null in the code you are updating
(and I'm not saying it can be, just if it was),
then neither mac_obj nor vlan_obj would be NULL due to the
layout of struct bnx2x_vf_queue.

> Remove superfluous NULL-pointer check and associated
> unreachable code to improve readability.

I also agree with this.

> Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>

...

  reply	other threads:[~2024-07-13 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 18:54 [PATCH net-next] bnx2x: remove redundant NULL-pointer check Nikita Kiryushin
2024-07-13 18:29 ` Simon Horman [this message]
2024-07-15 13:52   ` Nikita Kiryushin
2024-07-15 18:10     ` Simon Horman
2024-07-16 19:23       ` Nikita Kiryushin

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=20240713182928.GA8432@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kiryushin@ancud.ru \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=skalluru@marvell.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;
as well as URLs for NNTP newsgroup(s).