From: "nickcheng" <nick.cheng@areca.com.tw>
To: 'James Bottomley' <James.Bottomley@HansenPartnership.com>
Cc: 'Andrew Morton' <akpm@linux-foundation.org>,
linux-scsi@vger.kernel.org, randy.dunlap@oracle.com,
'Tomas Henzl' <thenzl@redhat.com>,
viro@ftp.linux.org.uk
Subject: RE: [PATCH] modify the type of element of MessageUnit_B in arcmsr
Date: Thu, 6 Mar 2008 10:04:42 +0800 [thread overview]
Message-ID: <000601c87f2e$71731610$8800a8c0@Nick> (raw)
In-Reply-To: <1204731015.3047.16.camel@localhost.localdomain>
James,
You are such a great teacher.
I learned it.
So what about my last submitted patch?
Would it be turned down or go on?
-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com]
Sent: Wednesday, March 05, 2008 11:30 PM
To: nick.cheng@areca.com.tw
Cc: 'Andrew Morton'; linux-scsi@vger.kernel.org; randy.dunlap@oracle.com;
'Tomas Henzl'; viro@ftp.linux.org.uk
Subject: RE: [PATCH] modify the type of element of MessageUnit_B in arcmsr
On Wed, 2008-03-05 at 15:38 +0800, nickcheng wrote:
> James,
> Thanks for your care.
> I agree with your point of labeling the registers with their correct
width.
> But I did see an error.
> I have a script to load/unload driver modules for Type B Adapter
repeatedly.
> While unloading the former driver modules, it pops up the message,
> iounmap: bad address ffffc2000021f000
> Call Trace:
> [<ffffffff881ec2a2>] :arcmsr:arcmsr_free_ccb_pool+0x54/0x8f
Aha, that's because of this, isn't it:
iounmap(reg->drv2iop_doorbell_reg -
ARCMSR_DRV2IOP_DOORBELL);
iounmap(reg->ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER);
You're doing pointer subtraction on a uint32_t *, so it's subtracting in
units of four bytes. In many ways, converting the two pointers to void
* isn't much better, because gcc can sometimes complain it doesn't know
the width of a void * for pointer subtraction ... but mostly it just
treats it as byte width. What you actually want, to get the error to go
away is:
iounmap((u8 *)reg->drv2iop_doorbell_reg -
ARCMSR_DRV2IOP_DOORBELL);
iounmap((u8 *)reg->ioctl_wbuffer_reg -
ARCMSR_IOCTL_WBUFFER);
Which should ensure the pointer arithmetic is done correctly. Of
course, the ideal would be to get rid of the pointer subtraction ... it
always ends up causing subtle and hard to find problems.
James
next prev parent reply other threads:[~2008-03-06 2:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-04 9:49 [PATCH] modify the type of element of MessageUnit_B in arcmsr nickcheng
2008-03-04 16:39 ` James Bottomley
2008-03-05 7:38 ` nickcheng
2008-03-05 15:30 ` James Bottomley
2008-03-06 2:04 ` nickcheng [this message]
2008-03-06 22:28 ` James Bottomley
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='000601c87f2e$71731610$8800a8c0@Nick' \
--to=nick.cheng@areca.com.tw \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=thenzl@redhat.com \
--cc=viro@ftp.linux.org.uk \
/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