* [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe()
@ 2024-06-27 2:13 Ma Ke
2024-06-27 5:20 ` Ratheesh Kannoth
2024-06-27 7:17 ` Markus Elfring
0 siblings, 2 replies; 4+ messages in thread
From: Ma Ke @ 2024-06-27 2:13 UTC (permalink / raw)
To: wintera, twinkler, hca, gor, agordeev, borntraeger, svens,
bhelgaas
Cc: linux-s390, netdev, linux-kernel, Ma Ke
As the possible failure of the dma_set_max_seg_size(), we should better
check the return value of the dma_set_max_seg_size().
Fixes: b0da3498c587 ("PCI: Remove pci_set_dma_max_seg_size()")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
Changes in v2:
- modified the patch according to suggestions;
- modified Fixes line according to suggestions.
---
drivers/s390/net/ism_drv.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index e36e3ea165d3..54f6638e889c 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -620,7 +620,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_resource;
dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
- dma_set_max_seg_size(&pdev->dev, SZ_1M);
+ ret = dma_set_max_seg_size(&pdev->dev, SZ_1M);
+ if (ret)
+ goto err_resource;
+
pci_set_master(pdev);
ret = ism_dev_init(ism);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe()
2024-06-27 2:13 [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe() Ma Ke
@ 2024-06-27 5:20 ` Ratheesh Kannoth
2024-06-27 7:17 ` Markus Elfring
1 sibling, 0 replies; 4+ messages in thread
From: Ratheesh Kannoth @ 2024-06-27 5:20 UTC (permalink / raw)
To: Ma Ke
Cc: wintera, twinkler, hca, gor, agordeev, borntraeger, svens,
bhelgaas, linux-s390, netdev, linux-kernel
On 2024-06-27 at 07:43:14, Ma Ke (make24@iscas.ac.cn) wrote:
> As the possible failure of the dma_set_max_seg_size(), we should better
Could you expand on the scenario of failure ?
> check the return value of the dma_set_max_seg_size().
> +++ b/drivers/s390/net/ism_drv.c
> @@ -620,7 +620,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> goto err_resource;
>
> dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
> - dma_set_max_seg_size(&pdev->dev, SZ_1M);
> + ret = dma_set_max_seg_size(&pdev->dev, SZ_1M);
Same error check is not valid for dma_set_seg_boundary() ?
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe()
2024-06-27 2:13 [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe() Ma Ke
2024-06-27 5:20 ` Ratheesh Kannoth
@ 2024-06-27 7:17 ` Markus Elfring
2024-06-27 19:42 ` Andrew Lunn
1 sibling, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2024-06-27 7:17 UTC (permalink / raw)
To: Ma Ke, linux-s390, netdev, Alexander Gordeev, Alexandra Winter,
Christian Bornträger, David S. Miller, Gerd Bayer,
Heiko Carstens, Niklas Schnelle, Stefan Raspl, Sven Schnelle,
Thorsten Winkler, Vasily Gorbik, Wenjia Zhang
Cc: LKML, Ratheesh Kannoth
> As the possible failure of the dma_set_max_seg_size(), we should better
> check the return value of the dma_set_max_seg_size().
Please avoid the repetition of a function name in such a change description.
Can it be improved with corresponding imperative wordings?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc5#n94
…
> +++ b/drivers/s390/net/ism_drv.c
> @@ -620,7 +620,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> goto err_resource;
>
> dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
> - dma_set_max_seg_size(&pdev->dev, SZ_1M);
> + ret = dma_set_max_seg_size(&pdev->dev, SZ_1M);
> + if (ret)
> + goto err_resource;
> +
> pci_set_master(pdev);
…
A) Will the shown dma_set_seg_boundary() call trigger similar software development concerns?
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/dma-mapping.h#L562
B) Under which circumstances would you become interested to increase the application
of scope-based resource management here?
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/cleanup.h#L8
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe()
2024-06-27 7:17 ` Markus Elfring
@ 2024-06-27 19:42 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2024-06-27 19:42 UTC (permalink / raw)
To: Markus Elfring
Cc: Ma Ke, linux-s390, netdev, Alexander Gordeev, Alexandra Winter,
Christian Bornträger, David S. Miller, Gerd Bayer,
Heiko Carstens, Niklas Schnelle, Stefan Raspl, Sven Schnelle,
Thorsten Winkler, Vasily Gorbik, Wenjia Zhang, LKML,
Ratheesh Kannoth
> B) Under which circumstances would you become interested to increase the application
> of scope-based resource management here?
> https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/cleanup.h#L8
Hi Markus
Please stop this. We have said a number of times, we don't want them
in existing code, at least not yet. Please come back in a couple of
years time once we know a bit more about how this helps/hinders.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-27 19:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 2:13 [PATCH v2] s390/ism: Add check for dma_set_max_seg_size in ism_probe() Ma Ke
2024-06-27 5:20 ` Ratheesh Kannoth
2024-06-27 7:17 ` Markus Elfring
2024-06-27 19:42 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox