All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: QLogic-Storage-Upstream@qlogic.com,
	Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Cc: "James E.J. Bottomley" <JBottomley@odin.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] qla4xxx: remove some bogus casts
Date: Mon, 17 Aug 2015 14:36:47 +0000	[thread overview]
Message-ID: <20150817143647.GA23820@mwanda> (raw)

These casts are wrong and unnecessary.  They annoy static checkers
because they imply we are planning to write sizeof(long) bytes to a
sizeof(u32) buffer which would corrupt memory.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 4180d6d..d97ea5d 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -101,19 +101,13 @@ int qla4xxx_init_rings(struct scsi_qla_host *ha)
 	ha->response_ptr = &ha->response_ring[ha->response_out];
 
 	if (is_qla8022(ha)) {
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->req_q_out);
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->rsp_q_in);
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->rsp_q_out);
+		writel(0, &ha->qla4_82xx_reg->req_q_out);
+		writel(0, &ha->qla4_82xx_reg->rsp_q_in);
+		writel(0, &ha->qla4_82xx_reg->rsp_q_out);
 	} else if (is_qla8032(ha) || is_qla8042(ha)) {
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->req_q_in);
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_in);
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_out);
+		writel(0, &ha->qla4_83xx_reg->req_q_in);
+		writel(0, &ha->qla4_83xx_reg->rsp_q_in);
+		writel(0, &ha->qla4_83xx_reg->rsp_q_out);
 	} else {
 		/*
 		 * Initialize DMA Shadow registers.  The firmware is really

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: QLogic-Storage-Upstream@qlogic.com,
	Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Cc: "James E.J. Bottomley" <JBottomley@odin.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] qla4xxx: remove some bogus casts
Date: Mon, 17 Aug 2015 17:36:47 +0300	[thread overview]
Message-ID: <20150817143647.GA23820@mwanda> (raw)

These casts are wrong and unnecessary.  They annoy static checkers
because they imply we are planning to write sizeof(long) bytes to a
sizeof(u32) buffer which would corrupt memory.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 4180d6d..d97ea5d 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -101,19 +101,13 @@ int qla4xxx_init_rings(struct scsi_qla_host *ha)
 	ha->response_ptr = &ha->response_ring[ha->response_out];
 
 	if (is_qla8022(ha)) {
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->req_q_out);
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->rsp_q_in);
-		writel(0,
-		    (unsigned long  __iomem *)&ha->qla4_82xx_reg->rsp_q_out);
+		writel(0, &ha->qla4_82xx_reg->req_q_out);
+		writel(0, &ha->qla4_82xx_reg->rsp_q_in);
+		writel(0, &ha->qla4_82xx_reg->rsp_q_out);
 	} else if (is_qla8032(ha) || is_qla8042(ha)) {
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->req_q_in);
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_in);
-		writel(0,
-		       (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_out);
+		writel(0, &ha->qla4_83xx_reg->req_q_in);
+		writel(0, &ha->qla4_83xx_reg->rsp_q_in);
+		writel(0, &ha->qla4_83xx_reg->rsp_q_out);
 	} else {
 		/*
 		 * Initialize DMA Shadow registers.  The firmware is really

             reply	other threads:[~2015-08-17 14:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 14:36 Dan Carpenter [this message]
2015-08-17 14:36 ` [patch] qla4xxx: remove some bogus casts Dan Carpenter
2015-08-18  4:45 ` Bart Van Assche
2015-08-18  4:45   ` Bart Van Assche
2015-08-18  8:47   ` Dan Carpenter
2015-08-18  8:47     ` Dan Carpenter
2015-08-23  1:41     ` Bart Van Assche
2015-08-23  1:41       ` Bart Van Assche
2017-01-25 16:35       ` Bart Van Assche
2017-01-26  2:54         ` Martin K. Petersen

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=20150817143647.GA23820@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=JBottomley@odin.com \
    --cc=QLogic-Storage-Upstream@qlogic.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=vikas.chaudhary@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 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.