]> git.baikalelectronics.ru Git - kernel.git/commit
macb: propagate errors when getting optional clocks
authorMichael Tretter <m.tretter@pengutronix.de>
Fri, 18 Oct 2019 14:11:43 +0000 (16:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Oct 2019 18:58:39 +0000 (11:58 -0700)
commit4d5648c4654b7b99d0913090ca3db1ab6f62c721
tree99daa26a22b36c47f96eabda9fe45ed7df9c01fe
parentbf5f0dd7f816d01bcc1f03b3f7adc3117e337858
macb: propagate errors when getting optional clocks

The tx_clk, rx_clk, and tsu_clk are optional. Currently the macb driver
marks clock as not available if it receives an error when trying to get
a clock. This is wrong, because a clock controller might return
-EPROBE_DEFER if a clock is not available, but will eventually become
available.

In these cases, the driver would probe successfully but will never be
able to adjust the clocks, because the clocks were not available during
probe, but became available later.

For example, the clock controller for the ZynqMP is implemented in the
PMU firmware and the clocks are only available after the firmware driver
has been probed.

Use devm_clk_get_optional() in instead of devm_clk_get() to get the
optional clock and propagate all errors to the calling function.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb_main.c