All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: pxa_camera: Fix check for pdev->dev.of_node
Date: Fri, 21 Sep 2018 09:58:41 -0700	[thread overview]
Message-ID: <CAKwvOdk+u1EeREHkhtOGg9Didg6ibppz5Od8Txp7EnMw05gtFA@mail.gmail.com> (raw)
In-Reply-To: <20180921100045.20181-1-natechancellor@gmail.com>

On Fri, Sep 21, 2018 at 3:00 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns that the address of a pointer will always evaluated as true
> in a boolean context.
>
> drivers/media/platform/pxa_camera.c:2400:17: warning: address of
> 'pdev->dev.of_node' will always evaluate to 'true'
> [-Wpointer-bool-conversion]
>         if (&pdev->dev.of_node && !pcdev->pdata) {
>              ~~~~~~~~~~^~~~~~~ ~~
> 1 warning generated.
>
> Judging from the rest of the kernel, it seems like this was an error and
> just the value of of_node should be checked rather than the address.
>
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/media/platform/pxa_camera.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
> index 3288d22de2a0..6717834e8041 100644
> --- a/drivers/media/platform/pxa_camera.c
> +++ b/drivers/media/platform/pxa_camera.c
> @@ -2397,7 +2397,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
>         pcdev->res = res;
>
>         pcdev->pdata = pdev->dev.platform_data;
> -       if (&pdev->dev.of_node && !pcdev->pdata) {
> +       if (pdev->dev.of_node && !pcdev->pdata) {

pdev->dev.of_node is a `struct device_node *`, so this is the correct
way to check that it's not NULL.  It's use in
pxa_camera_pdata_from_dt() is necessitated on the caller checking that
it's not NULL.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>                 err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd);
>         } else {
>                 pcdev->platform_flags = pcdev->pdata->flags;
> --
> 2.19.0
>


-- 
Thanks,
~Nick Desaulniers

      reply	other threads:[~2018-09-21 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 10:00 [PATCH] media: pxa_camera: Fix check for pdev->dev.of_node Nathan Chancellor
2018-09-21 16:58 ` Nick Desaulniers [this message]

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=CAKwvOdk+u1EeREHkhtOGg9Didg6ibppz5Od8Txp7EnMw05gtFA@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=natechancellor@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 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.