From nobody Wed Jun 14 16:46:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QhBCJ1QTlz4dHm1; Wed, 14 Jun 2023 16:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QhBCJ0cs8z4PLx; Wed, 14 Jun 2023 16:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686761196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pNiKeTvJo6MHrqm4eRmRPRxWa+wIiryV8pAbhznQzqo=; b=NkPPOB2AyD3K3Xdh+7sFDEPcWanIcbgkWl1xaQjIUWpejkAb0ZIEryFL/zRbdtlsGs9y0k dmZzp8lnNiBBSdEfBUWBFE6rm06VEYW2UEHZEaAz70LLThrzmObZecLulWzXMo08menkdQ GazNNHz+e/8H70Z0WumECpXnMdIMvekDoCHHJiIoDIvRY+kLIz0iwFBxXR8gU0pqDbB+V3 qARjorW/Y6dIVeQLoOYVQUApttWDjtxwlWSpmKMbhPIzW5B4AiNlZJKXt8JVJ8GoD7kxBL LM3xVA/ybFaKSLOtAj/wH7gEIMwqIJx6SL5UtzIyIVolJC+0cus2FjS9hS/8qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686761196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pNiKeTvJo6MHrqm4eRmRPRxWa+wIiryV8pAbhznQzqo=; b=YiXXmRVUh0HqbhQePC2v9wC45Oswpeim1EKMiCp7rUzL1klw8/JPLiNkr3JbNX11bLy48c H93RgmcPVrQgF7LF8wZ6VRAamd0lyhD/for71aDhWRkFcCzuy/X1DT3bY5shKU6pxPaYZ5 41q8NwRGFoqA2Okce+iOURuzyNrgpboVvv2CWUz6vVhGGLQQ8Gph8hODZwlpQ/oGSXytYt FsBFoR2LMcYZBBV7Wa4LGTU5DDOL5lczwORKxDQO77LYZWn5aWFCCe4HmOgABpCOGn/jRj LjRfikggfqELT0uA+1dni9zC5GsGJil07RNo//hxEUI5+U4Wh7gFtsc9UDeD+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686761196; a=rsa-sha256; cv=none; b=hsQMX/zOMe1FdZhQBZp0HzNb4/9Nrs3woyi3S3//t8oh/4TwNHkQUwu2On3S0PWGjWynHD sgP7JkTiGdE/px+te6+BmjGrXTPcemx04Sjxi3fhlUisgAsb324WVYOdCePWWiIWnodHzS BF3IxjkO4VqOyKPXCSnXtFw0jhpmaFCcmd2wklhOMt7lB8nNozIdU8H9ZTj8ZWHnyNdqi/ qV8QAkvAR3DAllFur6w9oSZB3R3C4ZttVgTP+oz8e+R++7tJNKGGko8oPZgWnl0GZZu22+ htEJZwTdlioSUw4AmVLlCgbZCW67Nt3ORBC1jlh1pB6YYdOKRCyUdwxcLvsbxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QhBCH6HMNz1BG5; Wed, 14 Jun 2023 16:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35EGkZiE028302; Wed, 14 Jun 2023 16:46:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EGkZDg028301; Wed, 14 Jun 2023 16:46:35 GMT (envelope-from git) Date: Wed, 14 Jun 2023 16:46:35 GMT Message-Id: <202306141646.35EGkZDg028301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 52ebac7fd0c5 - main - hwpmc_mod.c: return statement style List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52ebac7fd0c52eeee0129fe11f9fbb5fe1bcb396 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=52ebac7fd0c52eeee0129fe11f9fbb5fe1bcb396 commit 52ebac7fd0c52eeee0129fe11f9fbb5fe1bcb396 Author: Mitchell Horne AuthorDate: 2023-06-14 16:31:06 +0000 Commit: Mitchell Horne CommitDate: 2023-06-14 16:34:20 +0000 hwpmc_mod.c: return statement style Reviewed by: jkoshy MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40513 --- sys/dev/hwpmc/hwpmc_mod.c | 80 ++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index b3cf309fb74e..779f6bf4dc32 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -567,7 +567,7 @@ pmc_debugflags_parse(char *newstr, char *fence) done: free(tmpflags, M_PMC); - return error; + return (error); } static int @@ -595,7 +595,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS) free(newstr, M_PMC); - return error; + return (error); } #endif @@ -820,11 +820,11 @@ pmc_rdtsc(void) { #if defined(__i386__) || defined(__amd64__) if (__predict_true(amd_feature & AMDID_RDTSCP)) - return rdtscp(); + return (rdtscp()); else - return rdtsc(); + return (rdtsc()); #else - return get_cyclecount(); + return (get_cyclecount()); #endif } @@ -1197,10 +1197,10 @@ pmc_attach_process(struct proc *p, struct pmc *pm) */ if ((pm->pm_flags & PMC_PP_ENABLE_MSR_ACCESS) != 0) - return EPERM; + return (EPERM); if ((pm->pm_flags & PMC_F_DESCENDANTS) == 0) - return pmc_attach_one_process(p, pm); + return (pmc_attach_one_process(p, pm)); /* * Traverse all child processes, attaching them to @@ -1232,7 +1232,7 @@ pmc_attach_process(struct proc *p, struct pmc *pm) done: sx_sunlock(&proctree_lock); - return error; + return (error); } /* @@ -1258,10 +1258,10 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags) pm, ri, p, p->p_pid, p->p_comm, flags); if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) - return ESRCH; + return (ESRCH); if (pp->pp_pmcs[ri].pp_pmc != pm) - return EINVAL; + return (EINVAL); pmc_unlink_target_process(pm, pp); @@ -1279,7 +1279,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags) __LINE__, pp->pp_refcnt, pp)); if (pp->pp_refcnt != 0) /* still a target of some PMC */ - return 0; + return (0); pmc_remove_process_descriptor(pp); @@ -1290,7 +1290,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags) p->p_flag &= ~P_HWPMC; PROC_UNLOCK(p); - return 0; + return (0); } /* @@ -1308,7 +1308,7 @@ pmc_detach_process(struct proc *p, struct pmc *pm) PMC_TO_ROWINDEX(pm), p, p->p_pid, p->p_comm); if ((pm->pm_flags & PMC_F_DESCENDANTS) == 0) - return pmc_detach_one_process(p, pm, PMC_FLAG_REMOVE); + return (pmc_detach_one_process(p, pm, PMC_FLAG_REMOVE)); /* * Traverse all children, detaching them from this PMC. We @@ -1342,7 +1342,7 @@ pmc_detach_process(struct proc *p, struct pmc *pm) if (LIST_EMPTY(&pm->pm_targets)) pm->pm_flags &= ~PMC_F_ATTACH_DONE; - return 0; + return (0); } @@ -2341,7 +2341,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg) } - return 0; + return (0); } /* @@ -2369,7 +2369,7 @@ pmc_allocate_owner_descriptor(struct proc *p) PMCDBG4(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p", p, p->p_pid, p->p_comm, po); - return po; + return (po); } static void @@ -2526,7 +2526,7 @@ pmc_find_thread_descriptor(struct pmc_process *pp, struct thread *td, free(ptnew, M_PMC); } - return pt; + return (pt); } /* @@ -2629,8 +2629,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode) if (ppnew != NULL) free(ppnew, M_PMC); - - return pp; + return (pp); } /* @@ -2688,7 +2687,7 @@ pmc_find_owner_descriptor(struct proc *p) PMCDBG5(OWN,FND,1, "find-owner proc=%p (%d, %s) hindex=0x%x -> " "pmc-owner=%p", p, p->p_pid, p->p_comm, hindex, po); - return po; + return (po); } /* @@ -2708,7 +2707,7 @@ pmc_allocate_pmc_descriptor(void) pmc->pm_pcpu_state = malloc(sizeof(struct pmc_pcpu_state)*mp_ncpus, M_PMC, M_WAITOK|M_ZERO); PMCDBG1(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc); - return pmc; + return (pmc); } /* @@ -2937,7 +2936,7 @@ pmc_register_owner(struct proc *p, struct pmc *pmc) if ((po = pmc_find_owner_descriptor(p)) == NULL) if ((po = pmc_allocate_owner_descriptor(p)) == NULL) - return ENOMEM; + return (ENOMEM); KASSERT(pmc->pm_owner == NULL, ("[pmc,%d] attempting to own an initialized PMC", __LINE__)); @@ -2955,7 +2954,7 @@ pmc_register_owner(struct proc *p, struct pmc *pmc) PMCDBG2(PMC,REG,1, "register-owner pmc-owner=%p pmc=%p", po, pmc); - return 0; + return (0); } /* @@ -2968,7 +2967,7 @@ pmc_register_owner(struct proc *p, struct pmc *pmc) int pmc_getrowdisp(int ri) { - return pmc_pmcdisp[ri]; + return (pmc_pmcdisp[ri]); } /* @@ -3018,12 +3017,11 @@ pmc_can_allocate_rowindex(struct proc *p, unsigned int ri, int cpu) */ if ((pp = pmc_find_process_descriptor(p, 0)) != NULL) if (pp->pp_pmcs[ri].pp_pmc) - return EEXIST; + return (EEXIST); PMCDBG4(PMC,ALR,2, "can-allocate-rowindex proc=%p (%d, %s) ri=%d ok", p, p->p_pid, p->p_comm, ri); - - return 0; + return (0); } /* @@ -3059,16 +3057,14 @@ pmc_can_allocate_row(int ri, enum pmc_mode mode) if (!PMC_ROW_DISP_IS_FREE(ri) && !(disp == PMC_DISP_THREAD && PMC_ROW_DISP_IS_THREAD(ri)) && !(disp == PMC_DISP_STANDALONE && PMC_ROW_DISP_IS_STANDALONE(ri))) - return EBUSY; + return (EBUSY); /* * All OK */ PMCDBG2(PMC,ALR,2, "can-allocate-row ri=%d mode=%d ok", ri, mode); - - return 0; - + return (0); } /* @@ -3088,7 +3084,7 @@ pmc_find_pmc_descriptor_in_process(struct pmc_owner *po, pmc_id_t pmcid) if (pm->pm_id == pmcid) return pm; - return NULL; + return (NULL); } static int @@ -3111,26 +3107,26 @@ pmc_find_pmc(pmc_id_t pmcid, struct pmc **pmc) */ if ((pp = pmc_find_process_descriptor(curthread->td_proc, PMC_FLAG_NONE)) == NULL) { - return ESRCH; + return (ESRCH); } else { opm = pp->pp_pmcs[PMC_ID_TO_ROWINDEX(pmcid)].pp_pmc; if (opm == NULL) - return ESRCH; + return (ESRCH); if ((opm->pm_flags & (PMC_F_ATTACHED_TO_OWNER| PMC_F_DESCENDANTS)) != (PMC_F_ATTACHED_TO_OWNER| PMC_F_DESCENDANTS)) - return ESRCH; + return (ESRCH); po = opm->pm_owner; } } if ((pm = pmc_find_pmc_descriptor_in_process(po, pmcid)) == NULL) - return EINVAL; + return (EINVAL); PMCDBG2(PMC,FND,2, "find-pmc id=%d -> pmc=%p", pmcid, pm); *pmc = pm; - return 0; + return (0); } /* @@ -3296,7 +3292,7 @@ pmc_stop(struct pmc *pm) */ if (PMC_IS_VIRTUAL_MODE(PMC_TO_MODE(pm))) - return 0; + return (0); /* * A system-mode PMC. Move to the CPU associated with @@ -3313,7 +3309,7 @@ pmc_stop(struct pmc *pm) ("[pmc,%d] illegal cpu=%d", __LINE__, cpu)); if (!pmc_cpu_is_active(cpu)) - return ENXIO; + return (ENXIO); pmc_select_cpu(cpu); @@ -5468,7 +5464,7 @@ pmc_mdep_alloc(int nclasses) /* Add base class. */ pmc_soft_initialize(md); - return md; + return (md); } void @@ -5557,7 +5553,7 @@ pmc_initialize(void) printf("hwpmc: kernel version (0x%x) does not match " "module version (0x%x).\n", pmc_kernel_version, PMC_VERSION); - return EPROGMISMATCH; + return (EPROGMISMATCH); } /* @@ -5982,5 +5978,5 @@ load (struct module *module __unused, int cmd, void *arg __unused) break; } - return error; + return (error); }