Skip to content

Commit 2f76986

Browse files
fangpeinaGUIDINGLI
authored andcommitted
system/fastboot: fix pre-existing nxstyle warnings
Add missing blank lines after variable declarations and fix alignment in preprocessor conditionals. These are pre-existing style issues exposed by the latest nxstyle version. Signed-off-by: fangpeina <fangpeina@xiaomi.com>
1 parent 3b993df commit 2f76986

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

system/fastboot/fastboot.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static FAR void *fastboot_memset32(FAR void *m, uint32_t val, size_t count)
347347
static ssize_t fastboot_read(int fd, FAR void *buf, size_t len)
348348
{
349349
ssize_t r = read(fd, buf, len);
350+
350351
return r < 0 ? -errno : r;
351352
}
352353

@@ -357,6 +358,7 @@ static int fastboot_write(int fd, FAR const void *buf, size_t len)
357358
while (len > 0)
358359
{
359360
ssize_t r = write(fd, data, len);
361+
360362
if (r < 0)
361363
{
362364
return -errno;
@@ -404,6 +406,7 @@ static void fastboot_okay(FAR struct fastboot_ctx_s *ctx,
404406
static int fastboot_flash_open(FAR const char *name)
405407
{
406408
int fd = open(name, O_RDWR | O_CLOEXEC);
409+
407410
if (fd < 0)
408411
{
409412
fb_err("Open %s error\n", name);
@@ -529,6 +532,7 @@ static int fastboot_flash_program(FAR struct fastboot_ctx_s *ctx, int fd)
529532
case FASTBOOT_CHUNK_RAW:
530533
{
531534
uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz;
535+
532536
ret = fastboot_flash_write(fd, ctx->download_offset,
533537
chunk_ptr, chunk_size);
534538
if (ret < 0)
@@ -544,6 +548,7 @@ static int fastboot_flash_program(FAR struct fastboot_ctx_s *ctx, int fd)
544548
{
545549
uint32_t fill_data = be32toh(*(FAR uint32_t *)chunk_ptr);
546550
uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz;
551+
547552
ret = ffastboot_flash_fill(fd, ctx->download_offset, fill_data,
548553
sparse->blk_sz, chunk->chunk_sz);
549554
if (ret < 0)
@@ -693,6 +698,7 @@ static void fastboot_download(FAR struct fastboot_ctx_s *ctx,
693698
while (len > 0)
694699
{
695700
ssize_t r = ctx->ops->read(ctx, download, len);
701+
696702
if (r < 0)
697703
{
698704
if (errno == EAGAIN)
@@ -851,6 +857,7 @@ static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *ctx)
851857
{
852858
ssize_t nread = fastboot_read(fd, ctx->download_buffer,
853859
MIN(size, ctx->download_max));
860+
854861
if (nread == 0)
855862
{
856863
break;
@@ -1036,6 +1043,7 @@ static void fastboot_oem(FAR struct fastboot_ctx_s *ctx, FAR const char *arg)
10361043
for (index = 0; index < ncmds; index++)
10371044
{
10381045
size_t len = strlen(g_oem_cmd[index].prefix);
1046+
10391047
if (memcmp(arg, g_oem_cmd[index].prefix, len) == 0)
10401048
{
10411049
arg += len;
@@ -1105,6 +1113,7 @@ static int fastboot_command_loop(FAR struct fastboot_ctx_s *ctx,
11051113
{
11061114
c = (FAR struct fastboot_ctx_s *)ev[n].data.ptr;
11071115
ssize_t r = c->ops->read(c, buffer, FASTBOOT_MSG_LEN);
1116+
11081117
if (r <= 0)
11091118
{
11101119
n--;
@@ -1115,6 +1124,7 @@ static int fastboot_command_loop(FAR struct fastboot_ctx_s *ctx,
11151124
for (index = 0; index < ncmds; index++)
11161125
{
11171126
size_t len = strlen(g_fast_cmd[index].prefix);
1127+
11181128
if (memcmp(buffer, g_fast_cmd[index].prefix, len) == 0)
11191129
{
11201130
g_fast_cmd[index].handle(c, buffer + len);
@@ -1221,9 +1231,9 @@ static int fastboot_usbdev_initialize(FAR struct fastboot_ctx_s *ctx)
12211231
#ifdef CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL
12221232
struct boardioc_usbdev_ctrl_s ctrl;
12231233
# ifdef CONFIG_USBDEV_COMPOSITE
1224-
uint8_t dev = BOARDIOC_USBDEV_COMPOSITE;
1234+
uint8_t dev = BOARDIOC_USBDEV_COMPOSITE;
12251235
# else
1226-
uint8_t dev = BOARDIOC_USBDEV_FASTBOOT;
1236+
uint8_t dev = BOARDIOC_USBDEV_FASTBOOT;
12271237
# endif
12281238
int ret;
12291239

0 commit comments

Comments
 (0)