mirror of https://github.com/torvalds/linux.git
net: stmmac: clean up stmmac_reset()
stmmac_reset() takes the stmmac_priv and an ioaddr. It has one call site, which passes the priv pointer, and dereferences priv for the ioaddr. stmmac_reset() then checks whether priv is NULL. If it was, the caller would have oopsed. Remove the checks for NULL, and move the dereference for ioaddr into stmmac_reset(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vImWF-0000000DrIr-1fmn@rmk-PC.armlinux.org.uk Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
9f07af1d27
commit
d0af55df5a
|
|
@ -103,12 +103,10 @@ static int stmmac_dwxlgmac_quirks(struct stmmac_priv *priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stmmac_reset(struct stmmac_priv *priv, void __iomem *ioaddr)
|
int stmmac_reset(struct stmmac_priv *priv)
|
||||||
{
|
{
|
||||||
struct plat_stmmacenet_data *plat = priv ? priv->plat : NULL;
|
struct plat_stmmacenet_data *plat = priv->plat;
|
||||||
|
void __iomem *ioaddr = priv->ioaddr;
|
||||||
if (!priv)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (plat && plat->fix_soc_reset)
|
if (plat && plat->fix_soc_reset)
|
||||||
return plat->fix_soc_reset(priv, ioaddr);
|
return plat->fix_soc_reset(priv, ioaddr);
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ extern const struct stmmac_tc_ops dwmac510_tc_ops;
|
||||||
#define GMAC_VERSION 0x00000020 /* GMAC CORE Version */
|
#define GMAC_VERSION 0x00000020 /* GMAC CORE Version */
|
||||||
#define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */
|
#define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */
|
||||||
|
|
||||||
int stmmac_reset(struct stmmac_priv *priv, void __iomem *ioaddr);
|
int stmmac_reset(struct stmmac_priv *priv);
|
||||||
int stmmac_hwif_init(struct stmmac_priv *priv);
|
int stmmac_hwif_init(struct stmmac_priv *priv);
|
||||||
|
|
||||||
#endif /* __STMMAC_HWIF_H__ */
|
#endif /* __STMMAC_HWIF_H__ */
|
||||||
|
|
|
||||||
|
|
@ -3162,7 +3162,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = stmmac_reset(priv, priv->ioaddr);
|
ret = stmmac_reset(priv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
netdev_err(priv->dev, "Failed to reset the dma\n");
|
netdev_err(priv->dev, "Failed to reset the dma\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue