diff mbox series

[2/2] nvdimm/pfn_dev: Avoid unnecessary endian conversion

Message ID 20230804084934.171056-2-aneesh.kumar@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series [1/2] nvdimm/pfn_dev: Prevent the creation of zero-sized namespaces | expand

Commit Message

Aneesh Kumar K.V Aug. 4, 2023, 8:49 a.m. UTC
use the local variable that already have the converted values.

No functional change in this patch.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 drivers/nvdimm/pfn_devs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jeff Moyer Aug. 4, 2023, 5:48 p.m. UTC | #1
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:

> use the local variable that already have the converted values.
>
> No functional change in this patch.
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  drivers/nvdimm/pfn_devs.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 36b904a129b9..8b7342517895 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -599,14 +599,12 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
>  		return -EOPNOTSUPP;
>  	}
>  
> -	if (!IS_ALIGNED(res->start + le32_to_cpu(pfn_sb->start_pad),
> -				memremap_compat_align())) {
> +	if (!IS_ALIGNED(res->start + start_pad, memremap_compat_align())) {
>  		dev_err(&nd_pfn->dev, "resource start misaligned\n");
>  		return -EOPNOTSUPP;
>  	}
>  
> -	if (!IS_ALIGNED(res->end + 1 - le32_to_cpu(pfn_sb->end_trunc),
> -				memremap_compat_align())) {
> +	if (!IS_ALIGNED(res->end + 1 - end_trunc, memremap_compat_align())) {
>  		dev_err(&nd_pfn->dev, "resource end misaligned\n");
>  		return -EOPNOTSUPP;
>  	}

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
diff mbox series

Patch

diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index 36b904a129b9..8b7342517895 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -599,14 +599,12 @@  int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
 		return -EOPNOTSUPP;
 	}
 
-	if (!IS_ALIGNED(res->start + le32_to_cpu(pfn_sb->start_pad),
-				memremap_compat_align())) {
+	if (!IS_ALIGNED(res->start + start_pad, memremap_compat_align())) {
 		dev_err(&nd_pfn->dev, "resource start misaligned\n");
 		return -EOPNOTSUPP;
 	}
 
-	if (!IS_ALIGNED(res->end + 1 - le32_to_cpu(pfn_sb->end_trunc),
-				memremap_compat_align())) {
+	if (!IS_ALIGNED(res->end + 1 - end_trunc, memremap_compat_align())) {
 		dev_err(&nd_pfn->dev, "resource end misaligned\n");
 		return -EOPNOTSUPP;
 	}