From: gyang <graf.yang@analog.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: graff yang <graff.yang@gmail.com>,
samuel@sortiz.org, irda-users@lists.sourceforge.net,
linux-kernel@vger.kernel.org, cooloney@kernel.org
Subject: Re: [PATCH] [net/irda]: new Blackfin on-chip SIR IrDA driver
Date: Thu, 12 Mar 2009 12:17:35 +0800 [thread overview]
Message-ID: <1236831455.21146.7.camel@dy> (raw)
In-Reply-To: <8bd0f97a0903110343m1f2f01catbc6cd54ecce91db9@mail.gmail.com>
On Wed, 2009-03-11 at 06:43 -0400, Mike Frysinger wrote:
> On Wed, Mar 11, 2009 at 05:56, graff yang wrote:
> > On Wed, Mar 11, 2009 at 3:57 PM, Mike Frysinger wrote:
> >> On Wed, Mar 11, 2009 at 03:29, <graff.yang@gmail.com> wrote:
> >>> +static int __devinit bfin_sir_probe(struct platform_device *pdev)
> >>> +{
> >>> + struct net_device *dev;
> >>> + struct bfin_sir_self *self;
> >>> + unsigned int baudrate_mask;
> >>> + struct bfin_sir_port *sir_port;
> >>> + int err;
> >>> +
> >>> + err = peripheral_request_list(per[pdev->id], DRIVER_NAME);
> >>
> >> what if pdev->id is set to 12512 ?
> >
> > The pdev->id is defined in board files, for example, uart0 should be 0.
>
> so ? what's to stop the user from setting it to 12415 ? the driver
> must sanity check these things. you can never assume platform dev
> resources always have valid pointers and valid values.
How about to limit the pdev->id to be 0,1,2,3 ?
I can extend the per to be
static const unsigned short per[][4] = {
{P_UART0_RX, P_UART0_TX, 0, 0},
{P_UART1_RX, P_UART1_TX, 0, 1},
{P_UART2_RX, P_UART2_TX, 0, 2},
{P_UART3_RX, P_UART3_TX, 0, 3},
};
then check (pdev->id >= 0 && pdev->id < ARRAY_SIZE(per) &&
per[pdev->id][3] == pdev->id)
>
> >>> + switch (max_rate) {
> >>> + default:
> >>> + printk(KERN_WARNING "bfin_sir: Invalid maximum baud rate, using 9600\n");
> >>
> >> dev_warn(&dev->dev,....) ?
> >
> > Here the netdev has not been registered.
>
> then use pdev->dev ?
Don't it seem strange to mixed use dev_warn(&dev->dev, ...) and
dev_warn(&pdev->dev, ...) ? And printk is enough.
> -mike
next prev parent reply other threads:[~2009-03-12 4:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 7:29 [PATCH] [net/irda]: new Blackfin on-chip SIR IrDA driver graff.yang
2009-03-11 7:37 ` Bryan Wu
[not found] ` <7d86d44a0903110117m4fc28b8bl5011493428d5a348@mail.gmail.com>
2009-03-11 8:46 ` Bryan Wu
2009-03-11 7:57 ` Mike Frysinger
2009-03-11 9:56 ` graff yang
2009-03-11 10:43 ` Mike Frysinger
2009-03-12 4:17 ` gyang [this message]
2009-03-12 4:23 ` Mike Frysinger
2009-03-12 4:30 ` gyang
2009-03-12 4:34 ` Mike Frysinger
2009-03-12 4:48 ` gyang
2009-03-12 4:59 ` Mike Frysinger
2009-03-12 5:55 ` graff yang
2009-03-12 6:24 ` Mike Frysinger
2009-03-12 7:43 ` graff yang
-- strict thread matches above, loose matches on Subject: below --
2009-03-10 7:29 graff.yang
2009-03-10 8:03 ` Mike Frysinger
[not found] ` <7d86d44a0903100425y2ed41d72p3ec43021f554af96@mail.gmail.com>
2009-03-10 11:29 ` Mike Frysinger
2009-03-10 11:41 ` Alan Cox
2009-03-10 11:47 ` Mike Frysinger
2009-03-10 11:48 ` gyang
2009-03-10 11:53 ` Mike Frysinger
2009-03-06 6:44 Bryan Wu
2009-03-06 22:58 ` Andrew Morton
2009-03-09 4:35 ` gyang
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=1236831455.21146.7.camel@dy \
--to=graf.yang@analog.com \
--cc=cooloney@kernel.org \
--cc=graff.yang@gmail.com \
--cc=irda-users@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=samuel@sortiz.org \
--cc=vapier.adi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox