Subject: qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c

From: Joe Perches <[email-masked]>
Date: Tue, 12 May 2015 11:42:25 -0700

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);