net: atlantic: make hw_get_regs optional
[ Upstream commit d0f23741c202c685447050713907f3be39a985ee ] This patch fixes potential crash in case if hw_get_regs is NULL. Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b80956bc0f
commit
79165d0335
1 changed files with 6 additions and 0 deletions
|
@ -620,6 +620,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)
|
|||
u32 *regs_buff = p;
|
||||
int err = 0;
|
||||
|
||||
if (unlikely(!self->aq_hw_ops->hw_get_regs))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
regs->version = 1;
|
||||
|
||||
err = self->aq_hw_ops->hw_get_regs(self->aq_hw,
|
||||
|
@ -634,6 +637,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)
|
||||
{
|
||||
if (unlikely(!self->aq_hw_ops->hw_get_regs))
|
||||
return 0;
|
||||
|
||||
return self->aq_nic_cfg.aq_hw_caps->mac_regs_count;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue