[PATCH v4 3/6] i3c: master: make sure the PID is set before registering the device

Przemysław Gaj
2019-12-10T10:15:50Z

If SETDASA failed for some reason or Provisioned ID (PID) retrieval
failed PID may not be set. Check that condition before registering
the device.

Signed-off-by: Przemysław Gaj <pgaj@cadence.com>
---
drivers/i3c/master.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index fab6e0609fca..4b3d1c0f778d 100755
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1450,7 +1450,8 @@ i3c_master_register_new_i3c_devs(struct i3c_master_controller *master)
return;

i3c_bus_for_each_i3cdev(&master->bus, desc) {
- if (desc->dev || !desc->info.dyn_addr || desc == master->this)
+ if (desc->dev || !desc->info.dyn_addr ||
+ desc == master->this || !desc->info.pid)
continue;

desc->dev = kzalloc(sizeof(*desc->dev), GFP_KERNEL);