net: macb: Add null check for PCLK and HCLK
authorHarini Katakam <harini.katakam@xilinx.com>
Wed, 20 Mar 2019 13:42:22 +0000 (19:12 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 May 2019 07:20:17 +0000 (09:20 +0200)
commitb435a79e5a873495e16589b8274f427c43891395
treed2ee6dee522785d77ab08bd54ac613be126878b5
parentf85682bc594ad483ae98c6391ea3bceeeedf9c86
net: macb: Add null check for PCLK and HCLK

[ Upstream commit cd5afa91f078c0787be0a62b5ef90301c00b0271 ]

Both PCLK and HCLK are "required" clocks according to macb devicetree
documentation. There is a chance that devm_clk_get doesn't return a
negative error but just a NULL clock structure instead. In such a case
the driver proceeds as usual and uses pclk value 0 to calculate MDC
divisor which is incorrect. Hence fix the same in clock initialization.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
drivers/net/ethernet/cadence/macb_main.c