All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] qed*: Add support for VFs over legacy PFs
Date: Fri, 30 Sep 2016 11:44:37 +0000	[thread overview]
Message-ID: <20160930114436.GA12102@mwanda> (raw)

Hello Yuval Mintz,

The patch d8c2c7e3404e: "qed*: Add support for VFs over legacy PFs"
from Aug 22, 2016, leads to the following static checker warning:

	drivers/net/ethernet/qlogic/qed/qed_vf.c:297 qed_vf_pf_acquire()
	warn: should this be a bitwise op?

drivers/net/ethernet/qlogic/qed/qed_vf.c
   289          /* Learn of the possibility of CMT */
   290          if (IS_LEAD_HWFN(p_hwfn)) {
   291                  if (resp->pfdev_info.capabilities & PFVF_ACQUIRE_CAP_100G) {
   292                          DP_NOTICE(p_hwfn, "100g VF\n");
   293                          p_hwfn->cdev->num_hwfns = 2;
   294                  }
   295          }
   296  
   297          if (!p_iov->b_pre_fp_hsi &&
   298              ETH_HSI_VER_MINOR &&
   299              (resp->pfdev_info.minor_fp_hsi < ETH_HSI_VER_MINOR)) {

It looks like this code works correctly.  I think the ETH_HSI_VER_MINOR
check is to silence a static checker warning because otherwise we are
occasionally comparing an unsigned with less than zero?  (Although I
think most static checkers will still complain so maybe that's not
true?).  Anyway, it's weird code.

It would probably be more clear to say "ETH_HSI_VER_MINOR > 0 &&".
When we're talking about comparisons to zero then it's idiomatic to use
"foo != 0" if we're talking about the number zero or strcmp() functions.
If it's used as a bool then we would say "!foo"...

   300                  DP_INFO(p_hwfn,
   301                          "PF is using older fastpath HSI; %02x.%02x is configured\n",
   302                          ETH_HSI_VER_MAJOR, resp->pfdev_info.minor_fp_hsi);
   303          }
   304  
   305  exit:
   306          qed_vf_pf_req_end(p_hwfn, rc);
   307  
   308          return rc;

regards,
dan carpenter

             reply	other threads:[~2016-09-30 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 11:44 Dan Carpenter [this message]
2016-09-30 12:05 ` [bug report] qed*: Add support for VFs over legacy PFs Mintz, Yuval

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=20160930114436.GA12102@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.