From: Stanislaw Gruszka <redacted>
Date: Thu, 2 Feb 2017 13:32:10 +0100
If ->get_regs_len() callback return 0, we allocate 0 bytes of memory,
what print ugly warning in dmesg, which can be found further below.
This happen on mac80211 devices where ieee80211_get_regs_len() just
return 0 and driver only fills ethtool_regs structure and actually
do not provide any dump. However I assume this can happen on other
drivers i.e. when for some devices driver provide regs dump and for
others do not. Hence preventing to to print warning in ethtool code
seems to be reasonable.
...
Signed-off-by: Stanislaw Gruszka <redacted>
---
v1 -> v2: nullify regbuf to avoid using uninitialized variable in line:
if (regbuf && copy_to_user(useraddr, regbuf, regs.len))
Applied, thanks.