netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>,
	Ron Mercer <ron.mercer@qlogic.com>,
	linux-driver@qlogic.com
Cc: netdev <netdev@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c
Date: Tue, 12 May 2015 11:42:25 -0700	[thread overview]
Message-ID: <1431456145.2884.75.camel@perches.com> (raw)

In ql_reset_work (line 3620)

The ql_reset_work function uses an "or" of 2 enum values.

enum { QL_RESET_DONE = 1,	/* Reset finished. */
	QL_RESET_ACTIVE = 2,	/* Waiting for reset to finish. */
	QL_RESET_START = 3,	/* Please reset the chip. */
	QL_RESET_PER_SCSI = 4,	/* SCSI driver requests reset. */
	QL_TX_TIMEOUT = 5,	/* Timeout in progress. */
	QL_LINK_MASTER = 6,	/* This driver controls the link. */
	QL_ADAPTER_UP = 7,	/* Adapter has been brought up. */

The values (3 and 4) or'd (added) together are
QL_ADAPTER_UP

If that's really what's desired, it'd be better to use
QL_ADAPTER_UP directly, though I'd expect this should
test both bits independently instead.

---

static void ql_reset_work(struct work_struct *work)
{
	struct ql3_adapter *qdev =
		container_of(work, struct ql3_adapter, reset_work.work);
	struct net_device *ndev = qdev->ndev;
	u32 value;
	struct ql_tx_buf_cb *tx_cb;
	int max_wait_time, i;
	struct ql3xxx_port_registers __iomem *port_regs =
		qdev->mem_map_registers;
	unsigned long hw_flags;

	if (test_bit((QL_RESET_PER_SCSI | QL_RESET_START), &qdev->flags)) {
		clear_bit(QL_LINK_MASTER, &qdev->flags);

             reply	other threads:[~2015-05-12 18:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 18:42 Joe Perches [this message]
2015-05-13 13:19 ` qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c Dan Carpenter
2015-05-13 16:08   ` Joe Perches
2015-05-13 17:34   ` Joe Perches
2015-05-14  8:01     ` Dan Carpenter
2015-05-14  8:22       ` Joe Perches

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=1431456145.2884.75.camel@perches.com \
    --to=joe@perches.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jitendra.kalsaria@qlogic.com \
    --cc=linux-driver@qlogic.com \
    --cc=netdev@vger.kernel.org \
    --cc=ron.mercer@qlogic.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).