diff mbox series

soc: qcom: apr: Drop redundant check in .remove()

Message ID 20220618203913.35785-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted
Headers show
Series soc: qcom: apr: Drop redundant check in .remove() | expand

Commit Message

Uwe Kleine-König June 18, 2022, 8:39 p.m. UTC
The remove callback is only called by the driver core if there is a
driver to unbind, so there is no need to check dev->driver to be
non-NULL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/soc/qcom/apr.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)


base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56

Comments

Bjorn Andersson June 27, 2022, 8:03 p.m. UTC | #1
On Sat, 18 Jun 2022 22:39:13 +0200, Uwe Kleine-König wrote:
> The remove callback is only called by the driver core if there is a
> driver to unbind, so there is no need to check dev->driver to be
> non-NULL.
> 
> 

Applied, thanks!

[1/1] soc: qcom: apr: Drop redundant check in .remove()
      commit: bc0f149376894343839c4b156fa5653958fda496

Best regards,
diff mbox series

Patch

diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index 3caabd873322..b4046f393575 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -377,17 +377,14 @@  static int apr_device_probe(struct device *dev)
 static void apr_device_remove(struct device *dev)
 {
 	struct apr_device *adev = to_apr_device(dev);
-	struct apr_driver *adrv;
+	struct apr_driver *adrv = to_apr_driver(dev->driver);
 	struct packet_router *apr = dev_get_drvdata(adev->dev.parent);
 
-	if (dev->driver) {
-		adrv = to_apr_driver(dev->driver);
-		if (adrv->remove)
-			adrv->remove(adev);
-		spin_lock(&apr->svcs_lock);
-		idr_remove(&apr->svcs_idr, adev->svc.id);
-		spin_unlock(&apr->svcs_lock);
-	}
+	if (adrv->remove)
+		adrv->remove(adev);
+	spin_lock(&apr->svcs_lock);
+	idr_remove(&apr->svcs_idr, adev->svc.id);
+	spin_unlock(&apr->svcs_lock);
 }
 
 static int apr_uevent(struct device *dev, struct kobj_uevent_env *env)