Skip to content

Commit 98ff79e

Browse files
Adrian Wareckilgirdwood
authored andcommitted
ipc_platform_send_msg: Replace goto with return.
Replaced assigning an error code to the ret variable and goto error with return error code. Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
1 parent 42025e5 commit 98ff79e

File tree

5 files changed

+14
-36
lines changed

5 files changed

+14
-36
lines changed

src/drivers/amd/renoir/ipc.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ void ipc_platform_complete_cmd(struct ipc *ipc)
168168

169169
int ipc_platform_send_msg(const struct ipc_msg *msg)
170170
{
171-
int ret = 0;
172171
acp_sw_intr_trig_t sw_intr_trig;
173172
acp_dsp_sw_intr_stat_t sw_intr_stat;
174173
uint32_t status;
@@ -182,20 +181,17 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
182181
sw_intr_stat = (acp_dsp_sw_intr_stat_t)
183182
io_reg_read(PU_REGISTER_BASE + ACP_DSP_SW_INTR_STAT);
184183
status = sw_intr_stat.bits.dsp0_to_host_intr_stat;
185-
ret = -EBUSY;
186-
goto out;
184+
return -EBUSY;
187185
}
188186
lock = io_reg_read(PU_REGISTER_BASE + ACP_AXI2DAGB_SEM_0);
189187
while (lock) {
190188
lock = io_reg_read(PU_REGISTER_BASE + ACP_AXI2DAGB_SEM_0);
191-
if (!delay_cnt) {
192-
ret = -EBUSY;
193-
break;
194-
}
189+
if (!delay_cnt)
190+
return -EBUSY;
191+
195192
delay_cnt--;
196193
}
197-
if (ret)
198-
goto out;
194+
199195
/* Write new message in the mailbox */
200196
mailbox_dspbox_write(0, msg->tx_data, msg->tx_size);
201197

@@ -208,8 +204,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
208204
sw_intr_trig.bits.trig_dsp0_to_host_intr = INTERRUPT_DISABLE;
209205
io_reg_write((PU_REGISTER_BASE + ACP_SW_INTR_TRIG), sw_intr_trig.u32all);
210206
io_reg_write((PU_REGISTER_BASE + ACP_AXI2DAGB_SEM_0), lock);
211-
out:
212-
return ret;
207+
return 0;
213208
}
214209

215210
int platform_ipc_init(struct ipc *ipc)

src/drivers/imx/ipc.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,11 @@ void ipc_platform_complete_cmd(struct ipc *ipc)
126126
int ipc_platform_send_msg(const struct ipc_msg *msg)
127127
{
128128
struct ipc *ipc = ipc_get();
129-
int ret = 0;
130129

131130
/* can't send notification when one is in progress */
132131
if (ipc->is_notification_pending ||
133132
imx_mu_read(IMX_MU_xCR(IMX_MU_VERSION, IMX_MU_GCR)) & IMX_MU_xCR_GIRn(IMX_MU_VERSION, 1)) {
134-
ret = -EBUSY;
135-
goto out;
133+
return -EBUSY;
136134
}
137135

138136
/* now send the message */
@@ -144,10 +142,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
144142

145143
/* now interrupt host to tell it we have sent a message */
146144
imx_mu_xcr_rmw(IMX_MU_VERSION, IMX_MU_GCR, IMX_MU_xCR_GIRn(IMX_MU_VERSION, 1), 0);
147-
148-
out:
149-
150-
return ret;
145+
return 0;
151146
}
152147

153148
#if CONFIG_HOST_PTABLE

src/drivers/intel/baytrail/ipc.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,11 @@ void ipc_platform_complete_cmd(struct ipc *ipc)
114114
int ipc_platform_send_msg(const struct ipc_msg *msg)
115115
{
116116
struct ipc *ipc = ipc_get();
117-
int ret = 0;
118117

119118
/* can't send notification when one is in progress */
120119
if (ipc->is_notification_pending ||
121120
shim_read(SHIM_IPCDH) & (SHIM_IPCDH_BUSY | SHIM_IPCDH_DONE)) {
122-
ret = -EBUSY;
123-
goto out;
121+
return -EBUSY;
124122
}
125123

126124
/* now send the message */
@@ -133,10 +131,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
133131
/* now interrupt host to tell it we have message sent */
134132
shim_write(SHIM_IPCDL, msg->header);
135133
shim_write(SHIM_IPCDH, SHIM_IPCDH_BUSY);
136-
137-
out:
138-
139-
return ret;
134+
return 0;
140135
}
141136

142137
struct ipc_data_host_buffer *ipc_platform_get_host_buffer(struct ipc *ipc)

src/drivers/intel/cavs/ipc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
218218
{
219219
struct ipc *ipc = ipc_get();
220220
ipc_cmd_hdr *hdr;
221-
int ret = 0;
222221

223222
if (ipc->is_notification_pending ||
224223
#if CAVS_VERSION == CAVS_VERSION_1_5
@@ -227,8 +226,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
227226
ipc_read(IPC_DIPCIDR) & IPC_DIPCIDR_BUSY ||
228227
ipc_read(IPC_DIPCIDA) & IPC_DIPCIDA_DONE) {
229228
#endif
230-
ret = -EBUSY;
231-
goto out;
229+
return -EBUSY;
232230
}
233231

234232
tr_dbg(&ipc_tr, "ipc: msg tx -> 0x%x", msg->header);
@@ -247,8 +245,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
247245
ipc_write(IPC_DIPCIDR, IPC_DIPCIDR_BUSY | hdr[0]);
248246
#endif
249247

250-
out:
251-
return ret;
248+
return 0;
252249
}
253250

254251
int platform_ipc_init(struct ipc *ipc)

src/drivers/intel/haswell/ipc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,11 @@ void ipc_platform_complete_cmd(struct ipc *ipc)
116116
int ipc_platform_send_msg(const struct ipc_msg *msg)
117117
{
118118
struct ipc *ipc = ipc_get();
119-
int ret = 0;
120119

121120
/* can't send nofication when one is in progress */
122121
if (ipc->is_notification_pending ||
123122
shim_read(SHIM_IPCD) & (SHIM_IPCD_BUSY | SHIM_IPCD_DONE)) {
124-
ret = -EBUSY;
125-
goto out;
123+
return -EBUSY;
126124
}
127125

128126
/* now send the message */
@@ -135,9 +133,7 @@ int ipc_platform_send_msg(const struct ipc_msg *msg)
135133
/* now interrupt host to tell it we have message sent */
136134
shim_write(SHIM_IPCD, SHIM_IPCD_BUSY);
137135

138-
out:
139-
140-
return ret;
136+
return 0;
141137
}
142138

143139
struct ipc_data_host_buffer *ipc_platform_get_host_buffer(struct ipc *ipc)

0 commit comments

Comments
 (0)