public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 1/1] dm: video: tegra124: incorrect logical condition
Date: Tue, 6 Mar 2018 11:08:26 +0100	[thread overview]
Message-ID: <20180306110826.78202316@crub> (raw)
In-Reply-To: <20180131001607.7941-1-xypron.glpk@gmx.de>

Hi all,

On Wed, 31 Jan 2018 01:16:07 +0100
Heinrich Schuchardt xypron.glpk at gmx.de wrote:

> 2 << 24 | A is always true. To use check against a bitmask we need &.

it is always true, but here we are not checking against a bitmask, so
the patch is wrong.

We set or clear register bit (depending on 'is_lvds' value) together
with another register bits for ROTCLK config.

So, I think the code should be

    2 << CSTM_ROTCLK_SHIFT |
    (is_lvds ? CSTM_LVDS_EN_ENABLE : CSTM_LVDS_EN_DISABLE)

But I do not have the hardware to test. Maybe Simon ?

> Identified with cppcheck.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> I do not have the hardware available. But the current coding is fishy.
> 
> Please, clarify what should be coded here.
> ---
>  drivers/video/tegra124/sor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c
> index 700ab25d46..4b3381fae2 100644
> --- a/drivers/video/tegra124/sor.c
> +++ b/drivers/video/tegra124/sor.c
> @@ -669,7 +669,7 @@ static void tegra_dc_sor_config_panel(struct tegra_dc_sor_data *sor,
>  	tegra_sor_write_field(sor, CSTM,
>  			      CSTM_ROTCLK_DEFAULT_MASK |
>  			      CSTM_LVDS_EN_ENABLE,
> -			      2 << CSTM_ROTCLK_SHIFT |
> +			      2 << CSTM_ROTCLK_SHIFT &
>  			      is_lvds ? CSTM_LVDS_EN_ENABLE :
>  			      CSTM_LVDS_EN_DISABLE);
>  

Thanks,

Anatolij

  reply	other threads:[~2018-03-06 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31  0:16 [U-Boot] [RFC 1/1] dm: video: tegra124: incorrect logical condition Heinrich Schuchardt
2018-03-06 10:08 ` Anatolij Gustschin [this message]
2018-03-07  0:31   ` Heinrich Schuchardt

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=20180306110826.78202316@crub \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /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