if (quiet)
                perf_quiet_option();
 
-       if (symbol_conf.vmlinux_name &&
-           access(symbol_conf.vmlinux_name, R_OK)) {
-               pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
-               ret = -EINVAL;
-               goto exit;
-       }
-       if (symbol_conf.kallsyms_name &&
-           access(symbol_conf.kallsyms_name, R_OK)) {
-               pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name);
-               ret = -EINVAL;
+       ret = symbol__validate_sym_arguments();
+       if (ret)
                goto exit;
-       }
 
        if (report.inverted_callchain)
                callchain_param.order = ORDER_CALLER;
 
                refcount_set(&mi->refcnt, 1);
        return mi;
 }
+
+/*
+ * Checks that user supplied symbol kernel files are accessible because
+ * the default mechanism for accessing elf files fails silently. i.e. if
+ * debug syms for a build ID aren't found perf carries on normally. When
+ * they are user supplied we should assume that the user doesn't want to
+ * silently fail.
+ */
+int symbol__validate_sym_arguments(void)
+{
+       if (symbol_conf.vmlinux_name &&
+           access(symbol_conf.vmlinux_name, R_OK)) {
+               pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
+               return -EINVAL;
+       }
+       if (symbol_conf.kallsyms_name &&
+           access(symbol_conf.kallsyms_name, R_OK)) {
+               pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name);
+               return -EINVAL;
+       }
+       return 0;
+}