Skip to content

Commit 38d98de

Browse files
committed
gpu: host1x: Call host1x_device_add() under lock
Instead of locking within host1x_device_add(), call it under the lock to make the locking more consistent. Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 536e171 commit 38d98de

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎drivers/gpu/host1x/bus.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,7 @@ static int host1x_device_add(struct host1x *host1x,
323323
return err;
324324
}
325325

326-
mutex_lock(&host1x->devices_lock);
327326
list_add_tail(&device->list, &host1x->devices);
328-
mutex_unlock(&host1x->devices_lock);
329327

330328
mutex_lock(&clients_lock);
331329

@@ -414,11 +412,11 @@ static void host1x_attach_driver(struct host1x *host1x,
414412
}
415413
}
416414

417-
mutex_unlock(&host1x->devices_lock);
418-
419415
err = host1x_device_add(host1x, driver);
420416
if (err < 0)
421417
dev_err(host1x->dev, "failed to allocate device: %d\n", err);
418+
419+
mutex_unlock(&host1x->devices_lock);
422420
}
423421

424422
static void host1x_detach_driver(struct host1x *host1x,

0 commit comments

Comments
 (0)