The QLIST_FOREACH() macro, defined in "qemu/queue.h",
always assigns its iterator variable when entering the
loop. Remove the pointless and possibly misleading
assignment.
Mechanical patch using the following coccinelle spatch:
@@
type T;
identifier e;
iterator FOREACH_MACRO =~ ".*_FOREACH.*";
statement S;
@@
- T *e = ...;
+ T *e;
... when != e
FOREACH_MACRO(e, ...) S
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <
20260415215539.92629-2-philmd@linaro.org>
int64_t bytes)
{
void *addr = s->bounce_pool.addr;
- BlkioBounceBuf *cur = NULL;
+ BlkioBounceBuf *cur;
BlkioBounceBuf *prev = NULL;
ptrdiff_t space;
static glfs_t *glfs_find_preopened(const char *volume)
{
- ListElement *entry = NULL;
+ ListElement *entry;
QLIST_FOREACH(entry, &glfs_list, list) {
if (strcmp(entry->saved.volume, volume) == 0) {
static void glfs_clear_preopened(glfs_t *fs)
{
- ListElement *entry = NULL;
+ ListElement *entry;
ListElement *next;
if (fs == NULL) {
{
int ecam_id = VIRT_ECAM_ID(vms->highmem_ecam);
bool cxl_present = false;
- PCIBus *bus = vms->bus;
+ PCIBus *bus;
bool acpi_pcihp = false;
if (vms->acpi_dev) {
static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size,
int page_mask)
{
- XenPhysmap *physmap = NULL;
+ XenPhysmap *physmap;
start_addr &= page_mask;
int page_mask)
{
hwaddr addr = phys_offset & page_mask;
- XenPhysmap *physmap = NULL;
+ XenPhysmap *physmap;
QLIST_FOREACH(physmap, &xen_physmap, list) {
if (range_covers_byte(physmap->phys_offset, physmap->size, addr)) {
IOMMUAccessFlags perm,
void (*trace_fn)(const char *id))
{
- RISCVIOMMUSpace *as = NULL;
+ RISCVIOMMUSpace *as;
IOMMUNotifier *n;
IOMMUTLBEvent event;
uint32_t pid;
void vfio_cpr_giommu_remap(VFIOContainer *bcontainer,
MemoryRegionSection *section)
{
- VFIOGuestIOMMU *giommu = NULL;
+ VFIOGuestIOMMU *giommu;
hwaddr as_offset = section->offset_within_address_space;
hwaddr iommu_offset = as_offset - section->offset_within_region;
MemoryRegionSection *section)
{
RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
- VFIORamDiscardListener *vrdl = NULL;
+ VFIORamDiscardListener *vrdl;
QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) {
if (vrdl->mr == section->mr &&
VFIORamDiscardListener *vfio_find_ram_discard_listener(
VFIOContainer *bcontainer, MemoryRegionSection *section)
{
- VFIORamDiscardListener *vrdl = NULL;
+ VFIORamDiscardListener *vrdl;
QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) {
if (vrdl->mr == section->mr &&
/* find emulate register group entry */
XenPTRegGroup *xen_pt_find_reg_grp(XenPCIPassthroughState *s, uint32_t address)
{
- XenPTRegGroup *entry = NULL;
+ XenPTRegGroup *entry;
/* find register group entry */
QLIST_FOREACH(entry, &s->reg_grps, entries) {
/* find emulate register entry */
XenPTReg *xen_pt_find_reg(XenPTRegGroup *reg_grp, uint32_t address)
{
- XenPTReg *reg_entry = NULL;
+ XenPTReg *reg_entry;
XenPTRegInfo *reg = NULL;
uint32_t real_offset = 0;