* [patch] sata, highbank: clear whole array in highbank_initialize_phys()
@ 2013-08-16 7:33 Dan Carpenter
2013-08-16 16:53 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-08-16 7:33 UTC (permalink / raw)
To: Tejun Heo
Cc: Grant Likely, Rob Herring, linux-ide, devicetree, kernel-janitors
The problem is that we use "CPHY_PORT_COUNT" as the size of the
tx_atten[] array, but that's the number of elements and not the number
of bytes. I've changed it to use sizeof(tx_atten) instead.
The other two calls to memset() were correct but I changed them as well
for consistency.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
We don't clear the cphy_base[] array. I don't know the code well enough
to say if that is intentional or not.
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 7f5e5d9..6abe2d5 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -347,9 +347,9 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
struct device_node *phy_nodes[CPHY_PHY_COUNT];
u32 tx_atten[CPHY_PORT_COUNT];
- memset(port_data, 0, sizeof(struct phy_lane_info) * CPHY_PORT_COUNT);
- memset(phy_nodes, 0, sizeof(struct device_node*) * CPHY_PHY_COUNT);
- memset(tx_atten, 0xff, CPHY_PORT_COUNT);
+ memset(port_data, 0, sizeof(port_data));
+ memset(phy_nodes, 0, sizeof(phy_nodes));
+ memset(tx_atten, 0xff, sizeof(tx_atten));
do {
u32 tmp;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] sata, highbank: clear whole array in highbank_initialize_phys()
2013-08-16 7:33 [patch] sata, highbank: clear whole array in highbank_initialize_phys() Dan Carpenter
@ 2013-08-16 16:53 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2013-08-16 16:53 UTC (permalink / raw)
To: Dan Carpenter
Cc: Grant Likely, Rob Herring, linux-ide, devicetree, kernel-janitors
Hello, Dan.
On Fri, Aug 16, 2013 at 10:33:36AM +0300, Dan Carpenter wrote:
> @@ -347,9 +347,9 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
> struct device_node *phy_nodes[CPHY_PHY_COUNT];
> u32 tx_atten[CPHY_PORT_COUNT];
>
> - memset(port_data, 0, sizeof(struct phy_lane_info) * CPHY_PORT_COUNT);
> - memset(phy_nodes, 0, sizeof(struct device_node*) * CPHY_PHY_COUNT);
> - memset(tx_atten, 0xff, CPHY_PORT_COUNT);
> + memset(port_data, 0, sizeof(port_data));
> + memset(phy_nodes, 0, sizeof(phy_nodes));
> + memset(tx_atten, 0xff, sizeof(tx_atten));
Ugh... why would anybody name a global variable port_data[]? So,
port_data is global and the other two are local. Wouldn't it be
better to just do "= { }" on declaration for the local ones?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-16 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 7:33 [patch] sata, highbank: clear whole array in highbank_initialize_phys() Dan Carpenter
2013-08-16 16:53 ` Tejun Heo
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).