mirror of https://github.com/xemu-project/xemu.git
Compress lines for immediate return
Compress two lines into a single line if immediate return statement is found. It also remove variables progress, val, data, ret and sock as they are no longer needed. Remove space between function "mixer_load" and '(' to fix the checkpatch.pl error:- ERROR: space prohibited between function name and open parenthesis '(' Done using following coccinelle script: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Simran Singhal <singhalsimran0@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200401165314.GA3213@simran-Inspiron-5558> [lv: in handle_aiocb_write_zeroes_unmap() move "int ret" inside the #ifdef] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
949da1eb9d
commit
b3ac2b94cd
|
@ -1617,13 +1617,12 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
|
||||||
{
|
{
|
||||||
RawPosixAIOData *aiocb = opaque;
|
RawPosixAIOData *aiocb = opaque;
|
||||||
BDRVRawState *s G_GNUC_UNUSED = aiocb->bs->opaque;
|
BDRVRawState *s G_GNUC_UNUSED = aiocb->bs->opaque;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* First try to write zeros and unmap at the same time */
|
/* First try to write zeros and unmap at the same time */
|
||||||
|
|
||||||
#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
|
#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
|
||||||
ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
|
int ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
|
||||||
aiocb->aio_offset, aiocb->aio_nbytes);
|
aiocb->aio_offset, aiocb->aio_nbytes);
|
||||||
if (ret != -ENOTSUP) {
|
if (ret != -ENOTSUP) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1631,8 +1630,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
|
||||||
|
|
||||||
/* If we couldn't manage to unmap while guaranteed that the area reads as
|
/* If we couldn't manage to unmap while guaranteed that the area reads as
|
||||||
* all-zero afterwards, just write zeroes without unmapping */
|
* all-zero afterwards, just write zeroes without unmapping */
|
||||||
ret = handle_aiocb_write_zeroes(aiocb);
|
return handle_aiocb_write_zeroes(aiocb);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_COPY_FILE_RANGE
|
#ifndef HAVE_COPY_FILE_RANGE
|
||||||
|
|
|
@ -623,8 +623,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->total_sectors = ret;
|
bs->total_sectors = ret;
|
||||||
ret = 0;
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QemuOptsList nfs_create_opts = {
|
static QemuOptsList nfs_create_opts = {
|
||||||
|
|
|
@ -575,11 +575,9 @@ static bool nvme_poll_cb(void *opaque)
|
||||||
{
|
{
|
||||||
EventNotifier *e = opaque;
|
EventNotifier *e = opaque;
|
||||||
BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
|
BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
|
||||||
bool progress = false;
|
|
||||||
|
|
||||||
trace_nvme_poll_cb(s);
|
trace_nvme_poll_cb(s);
|
||||||
progress = nvme_poll_queues(s);
|
return nvme_poll_queues(s);
|
||||||
return progress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
|
static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
|
||||||
|
|
|
@ -411,8 +411,7 @@ int vhdx_update_headers(BlockDriverState *bs, BDRVVHDXState *s,
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
|
return vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* opens the specified header block from the VHDX file header section */
|
/* opens the specified header block from the VHDX file header section */
|
||||||
|
|
|
@ -573,11 +573,9 @@ static uint32_t nam_readb (void *opaque, uint32_t addr)
|
||||||
static uint32_t nam_readw (void *opaque, uint32_t addr)
|
static uint32_t nam_readw (void *opaque, uint32_t addr)
|
||||||
{
|
{
|
||||||
AC97LinkState *s = opaque;
|
AC97LinkState *s = opaque;
|
||||||
uint32_t val = ~0U;
|
|
||||||
uint32_t index = addr;
|
uint32_t index = addr;
|
||||||
s->cas = 0;
|
s->cas = 0;
|
||||||
val = mixer_load (s, index);
|
return mixer_load(s, index);
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t nam_readl (void *opaque, uint32_t addr)
|
static uint32_t nam_readl (void *opaque, uint32_t addr)
|
||||||
|
|
|
@ -120,13 +120,10 @@ static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
|
||||||
static uint32_t adlib_read(void *opaque, uint32_t nport)
|
static uint32_t adlib_read(void *opaque, uint32_t nport)
|
||||||
{
|
{
|
||||||
AdlibState *s = opaque;
|
AdlibState *s = opaque;
|
||||||
uint8_t data;
|
|
||||||
int a = nport & 3;
|
int a = nport & 3;
|
||||||
|
|
||||||
adlib_kill_timers (s);
|
adlib_kill_timers (s);
|
||||||
data = OPLRead (s->opl, a);
|
return OPLRead (s->opl, a);
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timer_handler (void *opaque, int c, double interval_Sec)
|
static void timer_handler (void *opaque, int c, double interval_Sec)
|
||||||
|
|
|
@ -2411,12 +2411,10 @@ static uint64_t cirrus_linear_bitblt_read(void *opaque,
|
||||||
unsigned size)
|
unsigned size)
|
||||||
{
|
{
|
||||||
CirrusVGAState *s = opaque;
|
CirrusVGAState *s = opaque;
|
||||||
uint32_t ret;
|
|
||||||
|
|
||||||
/* XXX handle bitblt */
|
/* XXX handle bitblt */
|
||||||
(void)s;
|
(void)s;
|
||||||
ret = 0xff;
|
return 0xff;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cirrus_linear_bitblt_write(void *opaque,
|
static void cirrus_linear_bitblt_write(void *opaque,
|
||||||
|
|
|
@ -2135,9 +2135,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
|
||||||
}
|
}
|
||||||
trace_ram_postcopy_send_discard_bitmap();
|
trace_ram_postcopy_send_discard_bitmap();
|
||||||
|
|
||||||
ret = postcopy_each_ram_send_discard(ms);
|
return postcopy_each_ram_send_discard(ms);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
3
ui/gtk.c
3
ui/gtk.c
|
@ -1650,8 +1650,7 @@ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
G_CALLBACK(gd_menu_switch_vc), s);
|
G_CALLBACK(gd_menu_switch_vc), s);
|
||||||
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);
|
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);
|
||||||
|
|
||||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
|
return gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
|
||||||
return group;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_VTE)
|
#if defined(CONFIG_VTE)
|
||||||
|
|
|
@ -765,15 +765,12 @@ static int vsock_connect_addr(const struct sockaddr_vm *svm, Error **errp)
|
||||||
static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp)
|
static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp)
|
||||||
{
|
{
|
||||||
struct sockaddr_vm svm;
|
struct sockaddr_vm svm;
|
||||||
int sock = -1;
|
|
||||||
|
|
||||||
if (!vsock_parse_vaddr_to_sockaddr(vaddr, &svm, errp)) {
|
if (!vsock_parse_vaddr_to_sockaddr(vaddr, &svm, errp)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sock = vsock_connect_addr(&svm, errp);
|
return vsock_connect_addr(&svm, errp);
|
||||||
|
|
||||||
return sock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vsock_listen_saddr(VsockSocketAddress *vaddr,
|
static int vsock_listen_saddr(VsockSocketAddress *vaddr,
|
||||||
|
|
Loading…
Reference in New Issue