Message ID | 20250201130953.1377-2-thorsten.blum@linux.dev (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | EDAC: Simplify return statement in dct_ecc_enabled() | expand |
On Sat, Feb 01, 2025 at 02:09:54PM +0100, Thorsten Blum wrote: > Simplify the return statement to improve the code's readability. > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > drivers/edac/amd64_edac.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c > index 8414ceb43e4a..1f106b4fafdf 100644 > --- a/drivers/edac/amd64_edac.c > +++ b/drivers/edac/amd64_edac.c > @@ -3355,10 +3355,7 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt) > > edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled")); > > - if (!ecc_en || !nb_mce_en) > - return false; > - else > - return true; > + return ecc_en && nb_mce_en; > } > > static bool umc_ecc_enabled(struct amd64_pvt *pvt) > -- Looks good to me. Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com> Thanks, Yazen
> From: Thorsten Blum <thorsten.blum@linux.dev> > [...] > Subject: [PATCH] EDAC: Simplify return statement in dct_ecc_enabled() > > Simplify the return statement to improve the code's readability. > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > drivers/edac/amd64_edac.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index > 8414ceb43e4a..1f106b4fafdf 100644 > --- a/drivers/edac/amd64_edac.c > +++ b/drivers/edac/amd64_edac.c > @@ -3355,10 +3355,7 @@ static bool dct_ecc_enabled(struct amd64_pvt > *pvt) > > edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : > "disabled")); > > - if (!ecc_en || !nb_mce_en) > - return false; > - else > - return true; > + return ecc_en && nb_mce_en; > } LGTM. Thanks! Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
On Sat, Feb 01, 2025 at 02:09:54PM +0100, Thorsten Blum wrote: > Simplify the return statement to improve the code's readability. > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > drivers/edac/amd64_edac.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c > index 8414ceb43e4a..1f106b4fafdf 100644 > --- a/drivers/edac/amd64_edac.c > +++ b/drivers/edac/amd64_edac.c > @@ -3355,10 +3355,7 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt) > > edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled")); > > - if (!ecc_en || !nb_mce_en) > - return false; > - else > - return true; > + return ecc_en && nb_mce_en; > } > > static bool umc_ecc_enabled(struct amd64_pvt *pvt) > -- Applied, thanks.
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8414ceb43e4a..1f106b4fafdf 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3355,10 +3355,7 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt) edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled")); - if (!ecc_en || !nb_mce_en) - return false; - else - return true; + return ecc_en && nb_mce_en; } static bool umc_ecc_enabled(struct amd64_pvt *pvt)
Simplify the return statement to improve the code's readability. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> --- drivers/edac/amd64_edac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)