netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c
@ 2015-05-12 18:42 Joe Perches
  2015-05-13 13:19 ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2015-05-12 18:42 UTC (permalink / raw)
  To: Jitendra Kalsaria, Ron Mercer, linux-driver; +Cc: netdev, Dan Carpenter

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-14  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 18:42 qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c Joe Perches
2015-05-13 13:19 ` 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

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