Skip to content

Commit acbdad8

Browse files
pH5gregkh
authored andcommitted
serial: 8250_dw: simplify optional reset handling
As of commit bb47523 ("reset: make optional functions really optional"), the reset framework API calls use NULL pointers to describe optional, non-present reset controls. This allows to return errors from devm_reset_control_get_optional and to call reset_control_(de)assert unconditionally. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 22077b0 commit acbdad8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/tty/serial/8250/8250_dw.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,11 @@ static int dw8250_probe(struct platform_device *pdev)
525525
}
526526

527527
data->rst = devm_reset_control_get_optional(dev, NULL);
528-
if (IS_ERR(data->rst) && PTR_ERR(data->rst) == -EPROBE_DEFER) {
529-
err = -EPROBE_DEFER;
528+
if (IS_ERR(data->rst)) {
529+
err = PTR_ERR(data->rst);
530530
goto err_pclk;
531531
}
532-
if (!IS_ERR(data->rst))
533-
reset_control_deassert(data->rst);
532+
reset_control_deassert(data->rst);
534533

535534
dw8250_quirks(p, data);
536535

@@ -562,8 +561,7 @@ static int dw8250_probe(struct platform_device *pdev)
562561
return 0;
563562

564563
err_reset:
565-
if (!IS_ERR(data->rst))
566-
reset_control_assert(data->rst);
564+
reset_control_assert(data->rst);
567565

568566
err_pclk:
569567
if (!IS_ERR(data->pclk))
@@ -584,8 +582,7 @@ static int dw8250_remove(struct platform_device *pdev)
584582

585583
serial8250_unregister_port(data->line);
586584

587-
if (!IS_ERR(data->rst))
588-
reset_control_assert(data->rst);
585+
reset_control_assert(data->rst);
589586

590587
if (!IS_ERR(data->pclk))
591588
clk_disable_unprepare(data->pclk);

0 commit comments

Comments
 (0)