From: David Decotigny <ddecotig@gmail.com>
To: netdev@vger.kernel.org
Cc: "Jeff Garzik" <jgarzik@pobox.com>,
"Ben Hutchings" <ben@decadent.org.uk>,
"David Miller" <davem@redhat.com>,
"Vidya Sagar Ravipati" <vidya@cumulusnetworks.com>,
"Joe Perches" <joe@perches.com>,
"Maciej Żenczykowski" <maze@google.com>,
"David Decotigny" <decot@googlers.com>
Subject: [ethtool PATCH v4 05/11] marvell.c: fix strict alias warnings
Date: Fri, 11 Mar 2016 09:58:18 -0800 [thread overview]
Message-ID: <1457719104-39188-6-git-send-email-ddecotig@gmail.com> (raw)
In-Reply-To: <1457719104-39188-1-git-send-email-ddecotig@gmail.com>
From: Maciej Żenczykowski <maze@google.com>
Addresses the following warnings:
marvell.c:426:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
marvell.c:427:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
marvell.c:428:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Note: code appears endian-dependent, not fixed by this commit.
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David Decotigny <decot@googlers.com>
---
marvell.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/marvell.c b/marvell.c
index e583c82..af21188 100644
--- a/marvell.c
+++ b/marvell.c
@@ -381,7 +381,8 @@ static void dump_prefetch(const char *name, const void *r)
int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
{
- const u32 *r = (const u32 *) regs->data;
+ const u16 *r16 = (const u16 *) regs->data;
+ const u32 *r32 = (const u32 *) regs->data;
int dual;
dump_pci(regs->data + 0x1c00);
@@ -390,15 +391,15 @@ int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
printf("\nBus Management Unit\n");
printf("-------------------\n");
- printf("CSR Receive Queue 1 0x%08X\n", r[24]);
- printf("CSR Sync Queue 1 0x%08X\n", r[26]);
- printf("CSR Async Queue 1 0x%08X\n", r[27]);
+ printf("CSR Receive Queue 1 0x%08X\n", r32[24]);
+ printf("CSR Sync Queue 1 0x%08X\n", r32[26]);
+ printf("CSR Async Queue 1 0x%08X\n", r32[27]);
dual = (regs->data[0x11e] & 2) != 0;
if (dual) {
- printf("CSR Receive Queue 2 0x%08X\n", r[25]);
- printf("CSR Async Queue 2 0x%08X\n", r[29]);
- printf("CSR Sync Queue 2 0x%08X\n", r[28]);
+ printf("CSR Receive Queue 2 0x%08X\n", r32[25]);
+ printf("CSR Async Queue 2 0x%08X\n", r32[29]);
+ printf("CSR Sync Queue 2 0x%08X\n", r32[28]);
}
dump_mac(regs->data);
@@ -423,9 +424,9 @@ int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
dump_timer("TX status", regs->data + 0xec0);
dump_timer("ISR", regs->data + 0xed0);
- printf("\nGMAC control 0x%04X\n", *(u32 *)(regs->data + 0xf00));
- printf("GPHY control 0x%04X\n", *(u32 *)(regs->data + 0xf04));
- printf("LINK control 0x%02hX\n", *(u16 *)(regs->data + 0xf10));
+ printf("\nGMAC control 0x%04X\n", r32[0xf00 >> 2]);
+ printf("GPHY control 0x%04X\n", r32[0xf04 >> 2]);
+ printf("LINK control 0x%02hX\n", r16[0xf10 >> 1]);
dump_gmac("GMAC 1", regs->data + 0x2800);
dump_gmac_fifo("Rx GMAC 1", regs->data + 0xc40);
--
2.7.0.rc3.207.g0ac5344
next prev parent reply other threads:[~2016-03-11 17:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 17:58 [ethtool PATCH v4 00/11] add support for new ETHTOOL_xLINKSETTINGS ioctls David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 01/11] internal.h: change to new sane kernel headers on 64-bit archs David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 02/11] ethtool.c: don't ignore fread() return value David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 03/11] ethtool.c: fix dump_regs heap corruption David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 04/11] ethtool.c: do_seeprom checks for params & stdin sanity David Decotigny
2016-03-11 17:58 ` David Decotigny [this message]
2016-03-11 17:58 ` [ethtool PATCH v4 06/11] test-common.c: fix test_realloc(NULL, ...) David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 07/11] test-features.c: add braces around array initialization David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 08/11] kernel-copy.h: import kernel.h from net-next and use it David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 09/11] ethtool-copy.h: sync with net-next David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 10/11] ethtool.c: add support for ETHTOOL_xLINKSETTINGS ioctls David Decotigny
2016-03-14 1:32 ` Ben Hutchings
2016-03-14 16:43 ` David Laight
2016-03-15 23:42 ` David Decotigny
2016-03-15 23:47 ` David Decotigny
2016-03-11 17:58 ` [ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets David Decotigny
2016-03-13 17:24 ` Ben Hutchings
2016-03-15 23:19 ` David Decotigny
2016-03-15 23:23 ` Ben Hutchings
2016-03-13 17:30 ` [ethtool PATCH v4 00/11] add support for new ETHTOOL_xLINKSETTINGS ioctls Ben Hutchings
2016-03-14 0:27 ` Ben Hutchings
-- strict thread matches above, loose matches on Subject: below --
2016-03-08 3:34 David Decotigny
2016-03-08 3:34 ` [ethtool PATCH v4 05/11] marvell.c: fix strict alias warnings David Decotigny
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=1457719104-39188-6-git-send-email-ddecotig@gmail.com \
--to=ddecotig@gmail.com \
--cc=ben@decadent.org.uk \
--cc=davem@redhat.com \
--cc=decot@googlers.com \
--cc=jgarzik@pobox.com \
--cc=joe@perches.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=vidya@cumulusnetworks.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;
as well as URLs for NNTP newsgroup(s).