Skip to content

Commit 6d2bce6

Browse files
ambarusherbertx
authored andcommitted
crypto: atmel-ecc - fix signed integer to u8 assignment
static checker warning: drivers/crypto/atmel-ecc.c:281 atmel_ecdh_done() warn: assigning (-22) to unsigned variable 'status' Similar warning can be raised in atmel_ecc_work_handler() when atmel_ecc_send_receive() returns an error. Fix this too. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Tudor Ambarus <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 952035b commit 6d2bce6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/crypto/atmel-ecc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ struct atmel_ecdh_ctx {
9999
* @work_data: data structure representing the work
100100
* @areq : optional pointer to an argument passed with the original
101101
* request.
102-
* @status : status returned from the device.
102+
* @status : status returned from the i2c client device or i2c error.
103103
* @areq: optional pointer to a user argument for use at callback time.
104104
* @work: describes the task to be executed.
105105
* @cmd : structure used for communicating with the device.
106106
*/
107107
struct atmel_ecc_work_data {
108108
struct atmel_ecdh_ctx *ctx;
109109
void (*cbk)(struct atmel_ecc_work_data *work_data, void *areq,
110-
u8 status);
110+
int status);
111111
void *areq;
112112
struct work_struct work;
113113
struct atmel_ecc_cmd cmd;
@@ -263,7 +263,7 @@ static int atmel_ecc_sleep(struct i2c_client *client)
263263
}
264264

265265
static void atmel_ecdh_done(struct atmel_ecc_work_data *work_data, void *areq,
266-
u8 status)
266+
int status)
267267
{
268268
struct kpp_request *req = areq;
269269
struct atmel_ecdh_ctx *ctx = work_data->ctx;
@@ -344,15 +344,15 @@ static void atmel_ecc_work_handler(struct work_struct *work)
344344
container_of(work, struct atmel_ecc_work_data, work);
345345
struct atmel_ecc_cmd *cmd = &work_data->cmd;
346346
struct i2c_client *client = work_data->ctx->client;
347-
u8 status;
347+
int status;
348348

349349
status = atmel_ecc_send_receive(client, cmd);
350350
work_data->cbk(work_data, work_data->areq, status);
351351
}
352352

353353
static void atmel_ecc_enqueue(struct atmel_ecc_work_data *work_data,
354354
void (*cbk)(struct atmel_ecc_work_data *work_data,
355-
void *areq, u8 status),
355+
void *areq, int status),
356356
void *areq)
357357
{
358358
work_data->cbk = (void *)cbk;

0 commit comments

Comments
 (0)