From: Andy Shevchenko Date: Wed, 8 Jun 2022 12:03:56 +0000 (+0300) Subject: ptp_ocp: drop duplicate NULL check in ptp_ocp_detach() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3a544ebf9f99b612442064c792f34de5bad3cb31;p=linux.git ptp_ocp: drop duplicate NULL check in ptp_ocp_detach() Since platform_device_unregister() is NULL-aware, we don't need to duplicate this check. Remove it and fold the rest of the code. Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko Signed-off-by: Jakub Kicinski --- diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index c8dea4c89bc27..62c628ded9eeb 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -3701,10 +3701,8 @@ ptp_ocp_detach(struct ptp_ocp *bp) serial8250_unregister_port(bp->mac_port); if (bp->nmea_port != -1) serial8250_unregister_port(bp->nmea_port); - if (bp->spi_flash) - platform_device_unregister(bp->spi_flash); - if (bp->i2c_ctrl) - platform_device_unregister(bp->i2c_ctrl); + platform_device_unregister(bp->spi_flash); + platform_device_unregister(bp->i2c_ctrl); if (bp->i2c_clk) clk_hw_unregister_fixed_rate(bp->i2c_clk); if (bp->n_irqs)