]> git.karo-electronics.de Git - karo-tx-linux.git/commit
stmmac: verify the dma_cfg platform fields
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Wed, 18 Apr 2012 19:48:21 +0000 (19:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Apr 2012 00:08:59 +0000 (20:08 -0400)
commit0f1f88a875bd6c6725501183fabeb99a70c35757
tree9ac6a5af22c32206d0e23320f497f4e04fb41d7e
parent4bfcbd7abce2d9b56f10d455ffeab00584cd8045
stmmac: verify the dma_cfg platform fields

Recently the dma parameters that can be passed from the platform
have been moved from the plat_stmmacenet_data to the stmmac_dma_cfg.

In case of this new structure is not well allocated the driver can
fails. This is an example how this field is managed in ST platforms

static struct stmmac_dma_cfg gmac_dma_setting = {
        .pbl = 32,
};

static struct plat_stmmacenet_data stih415_ethernet_platform_data[] = {
{
.dma_cfg = &gmac_dma_setting,
.has_gmac = 1,
[snip]

This patch so verifies that the dma_cfg passed from the platform.
In case of it is NULL there is no reason that the driver has to fail
and some default values can be passed. These are ok for all the
Synopsys chips and could impact on performances, only.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
cc: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c