提交 d1cc0e93 编写于 作者: V Vladimir Oltean 提交者: David S. Miller

net: mscc: ocelot: error checking when calling ocelot_init()

ocelot_init() allocates memory, resets the switch and polls for a status
register, things which can fail. Stop probing the driver in that case,
and propagate the error result.
Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: NHoratiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Tested-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c9d4b2cf
......@@ -585,7 +585,10 @@ static int felix_setup(struct dsa_switch *ds)
if (err)
return err;
ocelot_init(ocelot);
err = ocelot_init(ocelot);
if (err)
return err;
if (ocelot->ptp) {
err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
if (err) {
......
......@@ -1002,7 +1002,10 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;
ocelot->vcap = vsc7514_vcap_props;
ocelot_init(ocelot);
err = ocelot_init(ocelot);
if (err)
goto out_put_ports;
if (ocelot->ptp) {
err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
if (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册