diff options
| author | Wayne Lin <[email protected]> | 2021-07-12 18:21:04 +0800 |
|---|---|---|
| committer | Wayne Lin <[email protected]> | 2021-07-12 18:21:04 +0800 |
| commit | a4818ad3ddf41a742395efbc35fcc938ddcc9312 (patch) | |
| tree | 072e0235dad87a3a5c8e731a7d9c0a81087e091d /components | |
| parent | 735285360929c97d49ed51dbc41dfeec570a35b3 (diff) | |
Fix error code and return value.
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/hwcrypto/hw_symmetric.c | 7 | ||||
| -rw-r--r-- | components/net/at/at_socket/at_socket.c | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/components/drivers/hwcrypto/hw_symmetric.c b/components/drivers/hwcrypto/hw_symmetric.c index 9398298fed..ffa5eca451 100644 --- a/components/drivers/hwcrypto/hw_symmetric.c +++ b/components/drivers/hwcrypto/hw_symmetric.c @@ -55,7 +55,8 @@ rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode struct hwcrypto_symmetric_info symmetric_info; rt_err_t err; - if (ctx == RT_NULL) + if ((ctx == RT_NULL) || + (mode != HWCRYPTO_MODE_ENCRYPT && mode != HWCRYPTO_MODE_DECRYPT)) { return -RT_EINVAL; } @@ -64,10 +65,6 @@ rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode { return -RT_ERROR; } - if (mode != HWCRYPTO_MODE_ENCRYPT && mode != HWCRYPTO_MODE_DECRYPT) - { - return -EINVAL; - } /* Input information packaging */ symmetric_info.mode = mode; diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 973be0acf4..cc3e26ed47 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -13,6 +13,7 @@ #include <string.h> #include <ctype.h> #include <sys/time.h> +#include <sys/errno.h> #include <at_socket.h> #include <at_device.h> @@ -1100,7 +1101,7 @@ static uint32_t ipstr_to_u32(char *ipstr) struct hostent *at_gethostbyname(const char *name) { struct at_device *device = RT_NULL; - ip_addr_t addr; + ip_addr_t addr = {0}; char ipstr[16] = { 0 }; /* buffer variables for at_gethostbyname() */ static struct hostent s_hostent; |
