Skip to content

Commit 8a47582

Browse files
Marek Vasutherbertx
authored andcommitted
crypto: caam - Pass error type into the functions
Pass the error type string into the functions, so they can handle the printing of the string. This is now still using the very unsafe sprintf(), but we will fix that. While at this, pass the device pointer too, so we can dev_err() functions readily when we start fixing this proper. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 867e1ee commit 8a47582

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

‎drivers/crypto/caam/error.c‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,15 @@ static void report_jump_idx(u32 status, char *outstr)
181181
SPRINTFCAT(outstr, "%d: ", idx, sizeof("255"));
182182
}
183183

184-
static void report_ccb_status(u32 status, char *outstr)
184+
static void report_ccb_status(struct device *jrdev, u32 status,
185+
const char *error, char *outstr)
185186
{
186187
u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >>
187188
JRSTA_CCBERR_CHAID_SHIFT;
188189
u8 err_id = status & JRSTA_CCBERR_ERRID_MASK;
189190

191+
sprintf(outstr, "%s: ", error);
192+
190193
report_jump_idx(status, outstr);
191194

192195
if (cha_id < ARRAY_SIZE(cha_id_list)) {
@@ -212,15 +215,19 @@ static void report_ccb_status(u32 status, char *outstr)
212215
}
213216
}
214217

215-
static void report_jump_status(u32 status, char *outstr)
218+
static void report_jump_status(struct device *jrdev, u32 status,
219+
const char *error, char *outstr)
216220
{
221+
sprintf(outstr, "%s: ", error);
217222
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__));
218223
}
219224

220-
static void report_deco_status(u32 status, char *outstr)
225+
static void report_deco_status(struct device *jrdev, u32 status,
226+
const char *error, char *outstr)
221227
{
222228
u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK;
223229
int i;
230+
sprintf(outstr, "%s: ", error);
224231

225232
report_jump_idx(status, outstr);
226233

@@ -237,22 +244,27 @@ static void report_deco_status(u32 status, char *outstr)
237244
}
238245
}
239246

240-
static void report_jr_status(u32 status, char *outstr)
247+
static void report_jr_status(struct device *jrdev, u32 status,
248+
const char *error, char *outstr)
241249
{
250+
sprintf(outstr, "%s: ", error);
242251
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__));
243252
}
244253

245-
static void report_cond_code_status(u32 status, char *outstr)
254+
static void report_cond_code_status(struct device *jrdev, u32 status,
255+
const char *error, char *outstr)
246256
{
257+
sprintf(outstr, "%s: ", error);
247258
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__));
248259
}
249260

250261
void caam_jr_strstatus(struct device *jrdev, u32 status)
251262
{
252263
char outstr[CAAM_ERROR_STR_MAX];
253264
static const struct stat_src {
254-
void (*report_ssed)(u32 status, char *outstr);
255-
char *error;
265+
void (*report_ssed)(struct device *jrdev, u32 status,
266+
const char *error, char *outstr);
267+
const char *error;
256268
} status_src[] = {
257269
{ NULL, "No error" },
258270
{ NULL, NULL },
@@ -274,9 +286,8 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
274286
return;
275287
}
276288

277-
sprintf(outstr, "%s: ", status_src[ssrc].error);
278-
279-
status_src[ssrc].report_ssed(status, outstr);
289+
status_src[ssrc].report_ssed(jrdev, status,
290+
status_src[ssrc].error, outstr);
280291

281292
dev_err(jrdev, "%08x: %s\n", status, outstr);
282293
}

0 commit comments

Comments
 (0)