Commit d0f23741 authored by Mark Starovoytov's avatar Mark Starovoytov Committed by David S. Miller

net: atlantic: make hw_get_regs optional

This patch fixes potential crash in case if hw_get_regs is NULL.
Signed-off-by: default avatarMark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36e90a52
...@@ -778,6 +778,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p) ...@@ -778,6 +778,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)
u32 *regs_buff = p; u32 *regs_buff = p;
int err = 0; int err = 0;
if (unlikely(!self->aq_hw_ops->hw_get_regs))
return -EOPNOTSUPP;
regs->version = 1; regs->version = 1;
err = self->aq_hw_ops->hw_get_regs(self->aq_hw, err = self->aq_hw_ops->hw_get_regs(self->aq_hw,
...@@ -792,6 +795,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p) ...@@ -792,6 +795,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)
int aq_nic_get_regs_count(struct aq_nic_s *self) int aq_nic_get_regs_count(struct aq_nic_s *self)
{ {
if (unlikely(!self->aq_hw_ops->hw_get_regs))
return 0;
return self->aq_nic_cfg.aq_hw_caps->mac_regs_count; return self->aq_nic_cfg.aq_hw_caps->mac_regs_count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment