* [PATCH] cxl/acpi: simplify returning pointer without cleanup
@ 2024-07-03 8:30 Krzysztof Kozlowski
2024-07-03 16:07 ` Dan Williams
2024-07-03 16:55 ` Alison Schofield
0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-03 8:30 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Dan Williams, linux-cxl, linux-kernel
Cc: Krzysztof Kozlowski
Use 'return_ptr' helper for returning a pointer without cleanup for
shorter code.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/cxl/acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
index 571069863c62..1e4bed8a933e 100644
--- a/drivers/cxl/acpi.c
+++ b/drivers/cxl/acpi.c
@@ -339,7 +339,7 @@ static struct resource *alloc_cxl_resource(resource_size_t base,
if (!res->name)
return NULL;
- return no_free_ptr(res);
+ return_ptr(res);
}
static int add_or_reset_cxl_resource(struct resource *parent, struct resource *res)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/acpi: simplify returning pointer without cleanup
2024-07-03 8:30 [PATCH] cxl/acpi: simplify returning pointer without cleanup Krzysztof Kozlowski
@ 2024-07-03 16:07 ` Dan Williams
2024-07-04 6:17 ` Krzysztof Kozlowski
2024-07-03 16:55 ` Alison Schofield
1 sibling, 1 reply; 4+ messages in thread
From: Dan Williams @ 2024-07-03 16:07 UTC (permalink / raw)
To: Krzysztof Kozlowski, Davidlohr Bueso, Jonathan Cameron,
Dave Jiang, Alison Schofield, Vishal Verma, Ira Weiny,
Dan Williams, linux-cxl, linux-kernel
Cc: Krzysztof Kozlowski
Krzysztof Kozlowski wrote:
> Use 'return_ptr' helper for returning a pointer without cleanup for
> shorter code.
No, thank you. For CXL, I am not a fan of macros with hidden 'return'
statements.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/acpi: simplify returning pointer without cleanup
2024-07-03 8:30 [PATCH] cxl/acpi: simplify returning pointer without cleanup Krzysztof Kozlowski
2024-07-03 16:07 ` Dan Williams
@ 2024-07-03 16:55 ` Alison Schofield
1 sibling, 0 replies; 4+ messages in thread
From: Alison Schofield @ 2024-07-03 16:55 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Vishal Verma,
Ira Weiny, Dan Williams, linux-cxl, linux-kernel
On Wed, Jul 03, 2024 at 10:30:55AM +0200, Krzysztof Kozlowski wrote:
> Use 'return_ptr' helper for returning a pointer without cleanup for
> shorter code.
>
My first thought on this was that I prefer the explicitness
of pairing __free(kfree) with no_free_ptr as was done here.
cleanup.h defines this:
#define return_ptr(p) return no_free_ptr(p)
I did read the comments and am still confused. I see you posted a
handful of no_free_ptr to return_ptr patches. What is your selection
process for changing these?
--Alison
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/cxl/acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 571069863c62..1e4bed8a933e 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -339,7 +339,7 @@ static struct resource *alloc_cxl_resource(resource_size_t base,
> if (!res->name)
> return NULL;
>
> - return no_free_ptr(res);
> + return_ptr(res);
> }
>
> static int add_or_reset_cxl_resource(struct resource *parent, struct resource *res)
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/acpi: simplify returning pointer without cleanup
2024-07-03 16:07 ` Dan Williams
@ 2024-07-04 6:17 ` Krzysztof Kozlowski
0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-04 6:17 UTC (permalink / raw)
To: Dan Williams, Davidlohr Bueso, Jonathan Cameron, Dave Jiang,
Alison Schofield, Vishal Verma, Ira Weiny, linux-cxl,
linux-kernel
On 03/07/2024 18:07, Dan Williams wrote:
> Krzysztof Kozlowski wrote:
>> Use 'return_ptr' helper for returning a pointer without cleanup for
>> shorter code.
>
> No, thank you. For CXL, I am not a fan of macros with hidden 'return'
> statements.
Sure, maybe the macro is not helpful in the first place.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-04 6:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 8:30 [PATCH] cxl/acpi: simplify returning pointer without cleanup Krzysztof Kozlowski
2024-07-03 16:07 ` Dan Williams
2024-07-04 6:17 ` Krzysztof Kozlowski
2024-07-03 16:55 ` Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox