* Re: [PATCH v2] iommu/qcom: Fix local_base status check
@ 2020-04-03 17:20 Markus Elfring
2020-04-03 17:45 ` Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Markus Elfring @ 2020-04-03 17:20 UTC (permalink / raw)
To: Tang Bin, iommu, linux-arm-msm, Andy Gross, Bjorn Andersson,
Jörg Rödel, Rob Clark
Cc: linux-kernel, kernel-janitors
> 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;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res)
> + if (res) {
> qcom_iommu->local_base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(qcom_iommu->local_base))
> + return PTR_ERR(qcom_iommu->local_base);
> + }
>
> qcom_iommu->iface_clk = devm_clk_get(dev, "iface");
…
Will the commit message be improved any further?
Would you like to add the tag “Fixes”?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] iommu/qcom: Fix local_base status check
2020-04-03 17:20 [PATCH v2] iommu/qcom: Fix local_base status check Markus Elfring
@ 2020-04-03 17:45 ` Markus Elfring
2020-04-03 17:45 ` Markus Elfring
2020-04-19 12:32 ` Markus Elfring
2 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2020-04-03 17:45 UTC (permalink / raw)
To: Bjorn Andersson, linux-arm-msm
Cc: linux-kernel, kernel-janitors, Andy Gross, Jörg Rödel,
Rob Clark, Tang Bin
> > ------v2-----------------
> > As requested, add some {} around this chunk.
> >
> > ------v1-----------------
>
> The changelog typically goes after the ---, as it doesn't add value to
> the resulting git log. So please drop the above 4 lines from the commit
> message. And please use ./scripts/get_maintainer.pl to find your
> recipient list.
>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
How does this tag fit to the requested changes?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] iommu/qcom: Fix local_base status check
2020-04-03 17:20 [PATCH v2] iommu/qcom: Fix local_base status check Markus Elfring
2020-04-03 17:45 ` Markus Elfring
@ 2020-04-03 17:45 ` Markus Elfring
2020-04-19 12:32 ` Markus Elfring
2 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2020-04-03 17:45 UTC (permalink / raw)
To: Bjorn Andersson, linux-arm-msm
Cc: linux-kernel, kernel-janitors, Andy Gross, Jörg Rödel,
Rob Clark, Tang Bin
> > ------v2-----------------
> > As requested, add some {} around this chunk.
> >
> > ------v1-----------------
>
> The changelog typically goes after the ---, as it doesn't add value to
> the resulting git log. So please drop the above 4 lines from the commit
> message. And please use ./scripts/get_maintainer.pl to find your
> recipient list.
>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
How does this tag fit to the requested changes?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] iommu/qcom: Fix local_base status check
2020-04-03 17:20 [PATCH v2] iommu/qcom: Fix local_base status check Markus Elfring
2020-04-03 17:45 ` Markus Elfring
2020-04-03 17:45 ` Markus Elfring
@ 2020-04-19 12:32 ` Markus Elfring
2020-04-19 13:10 ` Markus Elfring
2 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2020-04-19 12:32 UTC (permalink / raw)
To: Tang Bin, iommu, linux-arm-msm, Andy Gross, Bjorn Andersson,
Jörg Rödel, Rob Clark
Cc: linux-kernel, kernel-janitors
> 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 version number
according to previous review comments?
* Would you like to adjust the patch subject?
…
> +++ 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);
> - if (res)
I find the deletion of this check appropriate.
> + if (res) {
> qcom_iommu->local_base = devm_ioremap_resource(dev, res);
But I do not see a need to preserve such a check because this function
performs input parameter validation.
https://elixir.bootlin.com/linux/v5.7-rc1/source/lib/devres.c#L116
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/devres.c?id=50cc09c18985eacbbd666acfd7be2391394733f5#n116
Please take another look at a corresponding usage example.
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] iommu/qcom: Fix local_base status check
2020-04-19 12:32 ` Markus Elfring
@ 2020-04-19 13:10 ` Markus Elfring
0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2020-04-19 13:10 UTC (permalink / raw)
To: Tang Bin, iommu, linux-arm-msm, Andy Gross, Bjorn Andersson,
Jörg Rödel, Rob Clark
Cc: linux-kernel, kernel-janitors, Dejin Zheng
> …
>> +++ 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, res);
…
> Please take another look at a corresponding usage example.
I would like to point another possibility out for desirable software evolution.
How do you think about to call a “known” wrapper function instead?
devm_platform_get_and_ioremap_resource
https://elixir.bootlin.com/linux/v5.7-rc1/source/drivers/base/platform.c#L66
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/base/platform.c
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-19 13:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 17:20 [PATCH v2] iommu/qcom: Fix local_base status check Markus Elfring
2020-04-03 17:45 ` Markus Elfring
2020-04-03 17:45 ` Markus Elfring
2020-04-19 12:32 ` Markus Elfring
2020-04-19 13:10 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).