* [PATCH] nvme-apple: stop casting function pointer signatures
@ 2022-07-18 5:05 ` Christoph Hellwig
0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2022-07-18 5:05 UTC (permalink / raw)
To: marcan, sven; +Cc: alyssa, linux-nvme, linux-arm-kernel
Casting function pointers breaks control flow enforcement and is
generally a horrible coding style.
Add two wrapper to get rid of these casts.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/apple.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index 7816b5a7d0e1b..3cf607bb9ee6c 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1220,6 +1220,11 @@ static void apple_nvme_async_probe(void *data, async_cookie_t cookie)
nvme_put_ctrl(&anv->ctrl);
}
+static void devm_apple_nvme_put_tag_set(void *data)
+{
+ blk_mq_free_tag_set(data);
+}
+
static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
{
int ret;
@@ -1236,8 +1241,7 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
ret = blk_mq_alloc_tag_set(&anv->admin_tagset);
if (ret)
return ret;
- ret = devm_add_action_or_reset(anv->dev,
- (void (*)(void *))blk_mq_free_tag_set,
+ ret = devm_add_action_or_reset(anv->dev, devm_apple_nvme_put_tag_set,
&anv->admin_tagset);
if (ret)
return ret;
@@ -1261,8 +1265,8 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
ret = blk_mq_alloc_tag_set(&anv->tagset);
if (ret)
return ret;
- ret = devm_add_action_or_reset(
- anv->dev, (void (*)(void *))blk_mq_free_tag_set, &anv->tagset);
+ ret = devm_add_action_or_reset(anv->dev, devm_apple_nvme_put_tag_set,
+ &anv->tagset);
if (ret)
return ret;
@@ -1363,6 +1367,11 @@ static int apple_nvme_attach_genpd(struct apple_nvme *anv)
return 0;
}
+static void devm_apple_nvme_mempool_destroy(void *data)
+{
+ mempool_destroy(data);
+}
+
static int apple_nvme_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1460,8 +1469,8 @@ static int apple_nvme_probe(struct platform_device *pdev)
ret = -ENOMEM;
goto put_dev;
}
- ret = devm_add_action_or_reset(
- anv->dev, (void (*)(void *))mempool_destroy, anv->iod_mempool);
+ ret = devm_add_action_or_reset(anv->dev,
+ devm_apple_nvme_mempool_destroy, anv->iod_mempool);
if (ret)
goto put_dev;
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] nvme-apple: stop casting function pointer signatures
@ 2022-07-18 5:05 ` Christoph Hellwig
0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2022-07-18 5:05 UTC (permalink / raw)
To: marcan, sven; +Cc: alyssa, linux-nvme, linux-arm-kernel
Casting function pointers breaks control flow enforcement and is
generally a horrible coding style.
Add two wrapper to get rid of these casts.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/apple.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index 7816b5a7d0e1b..3cf607bb9ee6c 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1220,6 +1220,11 @@ static void apple_nvme_async_probe(void *data, async_cookie_t cookie)
nvme_put_ctrl(&anv->ctrl);
}
+static void devm_apple_nvme_put_tag_set(void *data)
+{
+ blk_mq_free_tag_set(data);
+}
+
static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
{
int ret;
@@ -1236,8 +1241,7 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
ret = blk_mq_alloc_tag_set(&anv->admin_tagset);
if (ret)
return ret;
- ret = devm_add_action_or_reset(anv->dev,
- (void (*)(void *))blk_mq_free_tag_set,
+ ret = devm_add_action_or_reset(anv->dev, devm_apple_nvme_put_tag_set,
&anv->admin_tagset);
if (ret)
return ret;
@@ -1261,8 +1265,8 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
ret = blk_mq_alloc_tag_set(&anv->tagset);
if (ret)
return ret;
- ret = devm_add_action_or_reset(
- anv->dev, (void (*)(void *))blk_mq_free_tag_set, &anv->tagset);
+ ret = devm_add_action_or_reset(anv->dev, devm_apple_nvme_put_tag_set,
+ &anv->tagset);
if (ret)
return ret;
@@ -1363,6 +1367,11 @@ static int apple_nvme_attach_genpd(struct apple_nvme *anv)
return 0;
}
+static void devm_apple_nvme_mempool_destroy(void *data)
+{
+ mempool_destroy(data);
+}
+
static int apple_nvme_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1460,8 +1469,8 @@ static int apple_nvme_probe(struct platform_device *pdev)
ret = -ENOMEM;
goto put_dev;
}
- ret = devm_add_action_or_reset(
- anv->dev, (void (*)(void *))mempool_destroy, anv->iod_mempool);
+ ret = devm_add_action_or_reset(anv->dev,
+ devm_apple_nvme_mempool_destroy, anv->iod_mempool);
if (ret)
goto put_dev;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
2022-07-18 5:05 ` Christoph Hellwig
@ 2022-07-18 16:00 ` Sven Peter
-1 siblings, 0 replies; 8+ messages in thread
From: Sven Peter @ 2022-07-18 16:00 UTC (permalink / raw)
To: hch, Hector Martin; +Cc: Alyssa Rosenzweig, linux-nvme, linux-arm-kernel
On Mon, Jul 18, 2022, at 07:05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
makes sense, thanks!
Sven
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
@ 2022-07-18 16:00 ` Sven Peter
0 siblings, 0 replies; 8+ messages in thread
From: Sven Peter @ 2022-07-18 16:00 UTC (permalink / raw)
To: hch, Hector Martin; +Cc: Alyssa Rosenzweig, linux-nvme, linux-arm-kernel
On Mon, Jul 18, 2022, at 07:05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
makes sense, thanks!
Sven
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
2022-07-18 5:05 ` Christoph Hellwig
@ 2022-07-18 21:37 ` Chaitanya Kulkarni
-1 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2022-07-18 21:37 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: alyssa, marcan, linux-nvme, linux-arm-kernel, sven
On 7/17/22 22:05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
totally, this should be avoided.
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
@ 2022-07-18 21:37 ` Chaitanya Kulkarni
0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2022-07-18 21:37 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: alyssa, marcan, linux-nvme, linux-arm-kernel, sven
On 7/17/22 22:05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
totally, this should be avoided.
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
2022-07-18 5:05 ` Christoph Hellwig
@ 2022-07-31 7:15 ` Hector Martin
-1 siblings, 0 replies; 8+ messages in thread
From: Hector Martin @ 2022-07-31 7:15 UTC (permalink / raw)
To: Christoph Hellwig, sven; +Cc: alyssa, linux-nvme, linux-arm-kernel
On 18/07/2022 14.05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hector Martin <marcan@marcan.st>
Yeah, casting function pointers is evil.
- Hector
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nvme-apple: stop casting function pointer signatures
@ 2022-07-31 7:15 ` Hector Martin
0 siblings, 0 replies; 8+ messages in thread
From: Hector Martin @ 2022-07-31 7:15 UTC (permalink / raw)
To: Christoph Hellwig, sven; +Cc: alyssa, linux-nvme, linux-arm-kernel
On 18/07/2022 14.05, Christoph Hellwig wrote:
> Casting function pointers breaks control flow enforcement and is
> generally a horrible coding style.
>
> Add two wrapper to get rid of these casts.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hector Martin <marcan@marcan.st>
Yeah, casting function pointers is evil.
- Hector
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-31 7:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18 5:05 [PATCH] nvme-apple: stop casting function pointer signatures Christoph Hellwig
2022-07-18 5:05 ` Christoph Hellwig
2022-07-18 16:00 ` Sven Peter
2022-07-18 16:00 ` Sven Peter
2022-07-18 21:37 ` Chaitanya Kulkarni
2022-07-18 21:37 ` Chaitanya Kulkarni
2022-07-31 7:15 ` Hector Martin
2022-07-31 7:15 ` Hector Martin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.