All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: deathsimple@vodafone.de
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/radeon: add radeon_atom_get_clock_dividers helper
Date: Thu, 18 Apr 2013 21:47:09 +0300	[thread overview]
Message-ID: <20130418184709.GA11596@elgon.mountain> (raw)

Hello Christian König,

The patch 7062ab67d4c6: "drm/radeon: add
radeon_atom_get_clock_dividers helper" from Apr 8, 2013, has endian
bugs.

drivers/gpu/drm/radeon/radeon_atombios.c
  2712                          if (clock_type == COMPUTE_ENGINE_PLL_PARAM) {
  2713                                  args.v3.ulClock.ulComputeClockFlag = clock_type;
  2714                                  args.v3.ulClock.ulClockFreq = cpu_to_le32(clock);       /* 10 khz */
                                                        ^^^^^^^^^^^
This is 24 bit bitfield so it can't store a __le32.  On little endian
systems it will truncate high bits away so that's ok, but on big endian
it will break.

  2715  
  2716                                  atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
  2717  
  2718                                  dividers->post_div = args.v3.ucPostDiv;
  2719                                  dividers->enable_post_div = (args.v3.ucCntlFlag &
  2720                                                               ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false;

There are a lot of other Sparse endian warnings but I haven't looked
at them.  Here is how to check:  http://lwn.net/Articles/205624/

regards,
dan carpenter

             reply	other threads:[~2013-04-18 18:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 18:47 Dan Carpenter [this message]
2013-04-19 15:45 ` drm/radeon: add radeon_atom_get_clock_dividers helper Christian König
2013-04-22 14:03 ` [PATCH] drm/radeon: fix endian bugs in radeon_atom_get_clock_dividers() alexdeucher
2013-04-22 14:08   ` Dan Carpenter
2013-04-22 14:18     ` Alex Deucher
2013-04-22 14:31       ` Dan Carpenter
2013-04-22 14:34         ` Alex Deucher
2013-04-22 15:29       ` Michel Dänzer
2013-04-22 16:15         ` Alex Deucher
2013-04-22 16:25           ` Michel Dänzer

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=20130418184709.GA11596@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.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.