return 0;
        }
 
-       dso = map__dso(al.map);
-       if (!thread__find_map(thread, *cpumode, start, &al) || !dso) {
+       if (!thread__find_map(thread, *cpumode, start, &al) || (dso = map__dso(al.map)) == NULL) {
                pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
                return 0;
        }
        unsigned line;
        int len;
        char *srccode;
-       struct dso *dso = map__dso(map);
+       struct dso *dso;
 
-       if (!map || !dso)
+       if (!map || (dso = map__dso(map)) == NULL)
                return 0;
        srcfile = get_srcline_split(dso,
                                    map__rip_2objdump(map, addr),
 
                 struct map_symbol *ms,
                 u64 addr)
 {
-       struct dso *dso = map__dso(ms->map);
+       struct dso *dso;
 
-       if (!ms->map || !dso || dso->annotate_warned)
+       if (!ms->map || (dso = map__dso(ms->map)) == NULL || dso->annotate_warned)
                return 0;
 
        if (!ms->sym)
 
 
        if (he->mem_info) {
                struct map *map = he->mem_info->daddr.ms.map;
-               struct dso *dso = map__dso(map);
+               struct dso *dso = map ? map__dso(map) : NULL;
 
                addr = cl_address(he->mem_info->daddr.al_addr, chk_double_cl);
                ms = &he->mem_info->daddr.ms;