From: Wolfram Sang <w.sang@pengutronix.de>
To: Karol Lewandowski <k.lewandowsk@samsung.com>
Cc: m.szyprowski@samsung.com, ben-linux@fluff.org,
thomas.abraham@linaro.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
linux-samsung-soc@vger.kernel.org, t.stanislaws@samsung.com,
kyungmin.park@samsung.com, broonie@opensource.wolfsonmicro.com,
"grant.likely@secretlab.ca" <grant.likely@secretlab.ca>
Subject: Re: [PATCH 1/2] i2c-s3c2410: Rework device type handling
Date: Tue, 24 Apr 2012 16:44:07 +0200 [thread overview]
Message-ID: <20120424144407.GA9007@pengutronix.de> (raw)
In-Reply-To: <4F966711.7080608@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
On Tue, Apr 24, 2012 at 10:40:49AM +0200, Karol Lewandowski wrote:
> On 23.04.2012 20:20, Wolfram Sang wrote:
>
> Hi!
>
> >> -static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
> >> +static inline unsigned int s3c24xx_get_device_quirks(struct platform_device *pdev)
> >> {
> >> - struct platform_device *pdev = to_platform_device(i2c->dev);
> >> - enum s3c24xx_i2c_type type;
> >> -
> >> -#ifdef CONFIG_OF
> >> - if (i2c->dev->of_node)
> >> - return of_device_is_compatible(i2c->dev->of_node,
> >> - "samsung,s3c2440-i2c");
> >> -#endif
> >> + if (pdev->dev.of_node) {
> >> + const struct of_device_id *match;
> >> + match = of_match_node(&s3c24xx_i2c_match, pdev->dev.of_node);
> >
> > I'd appreciate a comment explaining why match can't be NULL here (as to
> > my understanding, it can't). Or just check for it, but this way it looks
> > a bit fishy and people (hopefully ;)) will ask about it.
>
>
> My understanding is that it can't be null for exactly same reason why
> platform_get_device_id(pdev) can't be null either (see below).
>
> I.e. prerequisite for this code to be run at all (as it's called from
> driver's .probe()) is to be already matched against very same match
> table.
Yes, I agree. Yet, this is not obvious and people might try to fix it
(especially since programs like smatch report it as potentially
dangerous). Ah, whatever, I could simply apply the fix then :) OK.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-04-24 14:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 16:23 [PATCH v4 0/2] i2c-s3c2410: Updates for exynos4210 and DT-based systems Karol Lewandowski
2012-04-23 16:24 ` [PATCH 1/2] i2c-s3c2410: Rework device type handling Karol Lewandowski
2012-04-23 18:20 ` Wolfram Sang
2012-04-24 8:40 ` Karol Lewandowski
2012-04-24 14:44 ` Wolfram Sang [this message]
[not found] ` <20120424144407.GA9007-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-25 11:38 ` Karol Lewandowski
2012-04-25 11:38 ` Karol Lewandowski
[not found] ` <1335198241-19344-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-04-23 16:24 ` [PATCH 2/2] i2c-s3c2410: Add HDMIPHY quirk for S3C2440 Karol Lewandowski
2012-04-23 16:24 ` Karol Lewandowski
-- strict thread matches above, loose matches on Subject: below --
2012-03-09 17:04 [PATCH 0/2] i2c-s3c2410: Updates for exynos4210 and DT-based systems Karol Lewandowski
2012-03-09 17:04 ` [PATCH 1/2] i2c-s3c2410: Rework device type handling Karol Lewandowski
2012-03-12 5:58 ` Thomas Abraham
[not found] ` <CAJuYYwRDb-NvOzpzWtV8erw8UZeHjBUDUPjm-Cg0GTz6BCCV5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-12 13:16 ` Karol Lewandowski
2012-03-12 13:16 ` Karol Lewandowski
[not found] ` <4F5DF72F.4020009-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-03-12 14:21 ` Thomas Abraham
2012-03-12 14:21 ` Thomas Abraham
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=20120424144407.GA9007@pengutronix.de \
--to=w.sang@pengutronix.de \
--cc=ben-linux@fluff.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=k.lewandowsk@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=t.stanislaws@samsung.com \
--cc=thomas.abraham@linaro.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 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.