From: Greg KH <gregkh@linuxfoundation.org>
To: Bing Fan <hptsfb@gmail.com>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm pl011 serial: support multi-irq request
Date: Tue, 29 Jun 2021 14:18:06 +0200 [thread overview]
Message-ID: <YNsPfvcjH3Z6gSUw@kroah.com> (raw)
In-Reply-To: <d2ba9f70-2ace-d796-8ce8-fd56d73d145b@gmail.com>
On Tue, Jun 29, 2021 at 07:32:36PM +0800, Bing Fan wrote:
> hello,
>
> replied as below.
>
> and new patch is at the bottom.
Please submit this properly as the documentation says to do so, I can't
take an attachment :(
> > > + struct amba_device *amba_dev = (struct amba_device *)uap->port.dev;
> > Are you sure you can just cast this like this? Did you test this?
>
>
> Yes, i have tested and applied in my project.
>
> The function pl011_probe calls pl011_setup_port with &amba_dev->dev and uap
> params;
>
> and pl011_setup_port set uap->port.dev to the address of amba_dev->dev;
>
> the two structs' relationship is:
>
> struct amba_device {
>
> struct device dev;
>
> ……
>
> };
>
> When pointer(uap->port.dev) points to amba_dev->dev address, the momery
> actully stores
>
> content of struct amba_device; so the cast assignment can be forced to
> amba_dev.
That is now how this should work, use the correct container_of() cast
instead. That will always work no matter where struct device is in the
structure. You got lucky here :)
> > > +
> > > + if (!amba_dev)
> > > + return -1;
> > Do not make up error numbers, return a specific -ERR* value.
>
> changed to "return -ENODEV"
So this changed the logic of this function, is that ok?
> >
> > And how can this happen?
>
> The function pl011_setup_port isn't called, event pl011_probe isn't called.
And how can that ever happen?
thanks,
greg k-h
next prev parent reply other threads:[~2021-06-29 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 1:29 [PATCH] arm pl011 serial: support multi-irq request Bing Fan
2021-06-29 6:18 ` Greg KH
[not found] ` <d2ba9f70-2ace-d796-8ce8-fd56d73d145b@gmail.com>
2021-06-29 12:18 ` Greg KH [this message]
[not found] ` <8e3133f8-a528-70fb-d539-9508a6cdcd3a@gmail.com>
2021-06-29 13:14 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2021-06-28 7:19 bing fan
2021-06-28 8:48 ` Greg Kroah-Hartman
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=YNsPfvcjH3Z6gSUw@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=hptsfb@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/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).