mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-30 08:04:13 +08:00
staging: greybus: firmware: Convert sscanf calls to strtoul
Also convert the fw_update_type and fw_timeout variables to unsigned and update the printf specifier to %u. The FW_MGMT_IOC_SET_TIMEOUT_MS ioctl takes an unsigned int and checkpatch was complaining about not checking the sscanf return values. Signed-off-by: Michael Sartain <mikesart@fastmail.com> Acked-by: Viresh Kumar <viresh.kumar at linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
afb5fdfc12
commit
4da14d5922
@ -52,6 +52,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -68,8 +69,8 @@
|
||||
|
||||
static const char *firmware_tag;
|
||||
static const char *fwdev = FW_DEV_DEFAULT;
|
||||
static int fw_update_type = FW_UPDATE_TYPE_DEFAULT;
|
||||
static int fw_timeout = FW_TIMEOUT_DEFAULT;
|
||||
static unsigned int fw_update_type = FW_UPDATE_TYPE_DEFAULT;
|
||||
static unsigned int fw_timeout = FW_TIMEOUT_DEFAULT;
|
||||
|
||||
static struct fw_mgmt_ioc_get_intf_version intf_fw_info;
|
||||
static struct fw_mgmt_ioc_get_backend_version backend_fw_info;
|
||||
@ -204,6 +205,7 @@ retry_fw_update:
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd, ret;
|
||||
char *endptr;
|
||||
|
||||
if (argc > 1 &&
|
||||
(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
|
||||
@ -215,7 +217,7 @@ int main(int argc, char *argv[])
|
||||
fwdev = argv[1];
|
||||
|
||||
if (argc > 2)
|
||||
sscanf(argv[2], "%u", &fw_update_type);
|
||||
fw_update_type = strtoul(argv[2], &endptr, 10);
|
||||
|
||||
if (argc > 3)
|
||||
firmware_tag = argv[3];
|
||||
@ -225,9 +227,9 @@ int main(int argc, char *argv[])
|
||||
firmware_tag = FW_TAG_BCND_DEFAULT;
|
||||
|
||||
if (argc > 4)
|
||||
sscanf(argv[4], "%u", &fw_timeout);
|
||||
fw_timeout = strtoul(argv[4], &endptr, 10);
|
||||
|
||||
printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %d\n",
|
||||
printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %u\n",
|
||||
fwdev, fw_update_type == 0 ? "interface" : "backend",
|
||||
firmware_tag, fw_timeout);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user