Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()

2020-09-18 Thread Markus Elfring
… > +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c … > @@ -595,6 +597,7 @@ static int qcom_iommu_of_xlate(struct device *dev, struct > of_phandle_args *args) >* banks are ok, but multiple devices are not: >*/ > if (WARN_ON(qcom_iommu != dev_iommu_priv_g

Re: [RFC PATCH] vfio: type1: fix kthread use case

2020-07-06 Thread Markus Elfring
… > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -2798,7 +2798,7 @@ static int vfio_iommu_type1_dma_rw_chunk … > - bool kthread = current->mm == NULL; > + bool kthread_load_mm; > size_t offset; How do you think about to reduce the scope for such variables? https://refactoring.com/catal

Re: [RFC PATCH] vfio: type1: fix kthread use case

2020-07-06 Thread Markus Elfring
… > +++ b/drivers/vfio/vfio_iommu_type1.c … > @@ -2812,11 +2815,10 @@ static int vfio_iommu_type1_dma_rw_chunk … > if (!mm) > return -EPERM; > > - if (kthread) > + if (kthread && use_mm) Can another design approach make sense here? + bool thread_use_mm = ((curren

Re: [RFC PATCH] vfio: type1: fix kthread use case

2020-07-06 Thread Markus Elfring
>> Can it be helpful to convert initialisations for these variables >> into later assignments? > > Perhaps. Then it looks like the below. … > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -2798,9 +2798,12 @@ static int vfio_iommu_type1_dma_rw_chunk … > - bool kthread = current->mm == NULL; > +

Re: [RFC PATCH] vfio: type1: fix kthread use case

2020-07-06 Thread Markus Elfring
… > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -2798,7 +2798,8 @@ static int vfio_iommu_type1_dma_rw_chunk … > - bool kthread = current->mm == NULL; > + bool kthread = current->flags & PF_KTHREAD; > + bool use_mm = current->mm == NULL; … Can it be helpful to convert initialisations for

Re: [PATCH v2] iommu: Improve exception handling in iommu_group_alloc()

2020-06-02 Thread Markus Elfring
> Improve the exception handling to free the resources correctly when > failed to allocate an iommu group. I propose to avoid the specification of duplicate function calls. Will it become helpful to add a few jump targets? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Doc

Re: iommu: Improve exception handling in iommu_group_alloc()

2020-06-02 Thread Markus Elfring
>> Do you disagree to the application of the Linux coding style then >> for the recommended exception handling? > > No, that's not what I mean. My point is the exception handling in this > patch is simple and no need to add 'goto' statement which does not help > to improve readability. Do we come

Re: iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Markus Elfring
>> * I suggest to avoid the specification of duplicate function calls. >> Will it be helpful to add a few jump targets? >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162#n455 > > I do

Re: [PATCH] iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Markus Elfring
> Optimize the error handling to free the resources correctly when > failed to allocate an iommu group. * I would not categorise the desired completion of exception handling as a software optimisation. * Would you like to add the tag “Fixes” to the commit message? * I suggest to avoid the spec

Re: [PATCH v2] iommu/qcom: Fix local_base status check

2020-04-19 Thread Markus Elfring
> … >> +++ b/drivers/iommu/qcom_iommu.c >> @@ -813,8 +813,11 @@ static int qcom_iommu_device_probe(struct >> platform_device *pdev) >> qcom_iommu->dev = dev; >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); … >> qcom_iommu->local_base = devm_ioremap_resource(dev,

Re: [PATCH v2] iommu/qcom: Fix local_base status check

2020-04-19 Thread Markus Elfring
> The function qcom_iommu_device_probe() does not perform sufficient > error checking after executing devm_ioremap_resource(), which can > result in crashes if a critical error path is encountered. Your update suggestion will be rechecked once more. * Can it be that the patch would need a higher

Re: [PATCH v2] iommu/qcom: Fix local_base status check

2020-04-03 Thread Markus Elfring
> Release resources when exiting on error. I have got doubts that such a change description fits to the proposed source code adjustment. … > +++ b/drivers/iommu/qcom_iommu.c > @@ -813,8 +813,11 @@ static int qcom_iommu_device_probe(struct > platform_device *pdev) > qcom_iommu->dev = dev;

iommu/rockchip: Checking a device_link_add() call in rk_iommu_add_device()

2019-10-18 Thread Markus Elfring
Hello, I tried another script for the semantic patch language out. This source code analysis approach points out that the implementation of the function “rk_iommu_add_device” contains still an unchecked call of the function “device_link_add”. https://git.kernel.org/pub/scm/linux/kernel/git/next/li

iommu/exynos: Checking a device_link_add() call in exynos_iommu_add_device()

2019-10-17 Thread Markus Elfring
Hello, I tried another script for the semantic patch language out. This source code analysis approach points out that the implementation of the function “exynos_iommu_add_device” contains still an unchecked call of the function “device_link_add”. https://git.kernel.org/pub/scm/linux/kernel/git/tor

Re: [PATCH] iommu/mediatek: fix leaked of_node references

2019-04-17 Thread Markus Elfring
> The call to of_parse_phandle returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. Can a splitting of this information into two sentences help? > 581 static int mtk_iommu_probe(struct platform_device *pdev) > 582 { > ... I sugges

Re: [PATCH] iommu/mediatek: fix leaked of_node references

2019-04-17 Thread Markus Elfring
> The call to of_parse_phandle returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. Can a splitting of this information into two sentences help? > 581 static int mtk_iommu_probe(struct platform_device *pdev) > 582 { > ... I sugges

Re: ARM-SMMU: Delete error messages for a failed memory allocation in three functions

2018-01-22 Thread SF Markus Elfring
>> Date: Sat, 20 Jan 2018 15:30:17 +0100 >> >> Omit extra messages for a memory allocation failure in these functions. > > Why? Do you find the wording “WARNING: Possible unnecessary 'out of memory' message” (from the script “checkpatch.pl”) more reasonable? > This may as well be "delete some s

Re: [PATCH] Intel-IOMMU: Delete an error message for a failed memory allocation in init_dmars()

2018-01-20 Thread SF Markus Elfring
>> Date: Sat, 20 Jan 2018 13:51:49 +0100 >> >> Omit an extra message for a memory allocation failure in this function. >> >> This issue was detected by using the Coccinelle software. >> >> Signed-off-by: Markus Elfring > > NACK on this one and th

[PATCH] ARM-SMMU: Delete error messages for a failed memory allocation in three functions

2018-01-20 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Jan 2018 15:30:17 +0100 Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/arm-smmu-v3.c | 9 +++-- drivers/iommu/arm-smmu.c

[PATCH] iommu/dmar: Delete an error message for a failed memory allocation in dmar_alloc_pci_notify_info()

2018-01-20 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Jan 2018 14:55:21 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/dmar.c | 2 -- 1 file changed, 2 deletions(-) diff

[PATCH] Exynos-IOMMU: Delete an error message for a failed memory allocation in exynos_iommu_init()

2018-01-20 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Jan 2018 14:28:13 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/exynos-iommu.c | 2 -- 1 file changed, 2 deletions

[PATCH] Intel-IOMMU: Delete an error message for a failed memory allocation in init_dmars()

2018-01-20 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Jan 2018 13:51:49 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/intel-iommu.c | 1 - 1 file changed, 1 deletion

[PATCH] IPMMU-VMSA: Delete an error message for a failed memory allocation in ipmmu_probe()

2018-01-19 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 19 Jan 2018 22:22:38 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/ipmmu-vmsa.c | 4 +--- 1 file changed, 1 insertion

[PATCH] IOMMU-Tegra: gart: Delete two error messages for a failed memory allocation in tegra_gart_probe()

2018-01-19 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 19 Jan 2018 21:44:31 +0100 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/tegra-gart.c | 8 ++-- 1 file changed, 2 insertions

[PATCH 2/2] lib: Improve a size determination in seven functions

2017-10-07 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 7 Oct 2017 19:19:45 +0200 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This

[PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation

2017-10-07 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 7 Oct 2017 17:34:23 +0200 Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- lib/test_kasan.c | 5 ++--- lib/test_kmod.c | 8 ++-- lib

[PATCH 0/2] lib: Adjustments for 11 function implementations

2017-10-07 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 7 Oct 2017 19:39:29 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): test: Delete five error messages for a failed memory allocation Improve a size determination in seven functions lib/dma-debug.c

[PATCH] iommu/arm-smmu: Delete an unnecessary check before free_io_pgtable_ops()

2015-11-06 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 6 Nov 2015 18:32:41 +0100 The free_io_pgtable_ops() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring

Re: [PATCH 00/39] drop null test before destroy functions

2015-09-14 Thread SF Markus Elfring
> Recent commits to kernel/git/torvalds/linux.git have made the following > functions able to tolerate NULL arguments: > > kmem_cache_destroy (commit 3942d29918522) > mempool_destroy (commit 4e3ca3e033d1) > dma_pool_destroy (commit 44d7175da6ea) How do you think about to extend an other SmPL scrip

Re: [PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree"

2015-07-09 Thread SF Markus Elfring
> From: Markus Elfring > Date: Thu, 5 Feb 2015 17:54:16 +0100 > > The vfree() function performs also input parameter validation. > Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Marku

[PATCH] iommu/arm-smmu: Delete an unnecessary check before the function call "free_io_pgtable_ops"

2015-06-28 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 28 Jun 2015 15:55:11 +0200 The free_io_pgtable_ops() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring

[PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree"

2015-02-05 Thread SF Markus Elfring
From: Markus Elfring Date: Thu, 5 Feb 2015 17:54:16 +0100 The vfree() function performs also input parameter validation. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/iommu/tegra-gart.c | 3

Re: [PATCH 1/1] IOMMU-MSM: Deletion of unnecessary checks before the function call "clk_disable"

2014-10-22 Thread SF Markus Elfring
>> If you are convinced that dropping the null tests is a good idea, then you >> can submit the patch that makes the change to the relevant maintainers and >> mailing lists. >From af73fb59d5d4b2c289fb236d0752522b6b38 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date