soc: swr-mstr-ctrl: check for device number before port params init

If the peripheral device is not enumerated, device number is stuck at
0. Check device number for 0 before initializing port params.

Change-Id: I444b37d56bebdebf75e8e7554cd435beece6b066
This commit is contained in:
Phani Kumar Uppalapati
2022-07-25 14:02:11 -07:00
والد 290f69973e
کامیت 12625e7622

مشاهده پرونده

@@ -2494,6 +2494,10 @@ static int swrm_init_port_params(struct swr_master *mstr, u32 dev_num,
pr_err("%s: Invalid handle to swr controller\n", __func__);
return 0;
}
if (dev_num == 0) {
pr_err("%s: Invalid device number 0\n", __func__);
return -EINVAL;
}
for (i = 0; i < SWR_UC_MAX; i++) {
for (j = 0; j < num_ports; j++) {
port_id_offset = (dev_num - 1) * SWR_MAX_DEV_PORT_NUM + j;