* [PATCH] media: camss: Allocate camss struct as a managed device resource
@ 2022-05-13 8:05 Vladimir Zapolskiy
2022-05-18 18:46 ` Robert Foss
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Zapolskiy @ 2022-05-13 8:05 UTC (permalink / raw)
To: Robert Foss, Todor Tomov
Cc: Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab, linux-media,
linux-arm-msm
The change simplifies driver's probe and remove functions, no functional
change is intended.
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
---
The change is supposed to be applied on top of this one:
https://lore.kernel.org/linux-media/20220512082318.189398-1-vladimir.zapolskiy@linaro.org/
drivers/media/platform/qcom/camss/camss.c | 33 +++++++----------------
1 file changed, 10 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index e90fea28ac88..0f4908fa21e2 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -1751,7 +1751,7 @@ static int camss_probe(struct platform_device *pdev)
struct camss *camss;
int num_subdevs, ret;
- camss = kzalloc(sizeof(*camss), GFP_KERNEL);
+ camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL);
if (!camss)
return -ENOMEM;
@@ -1795,39 +1795,30 @@ static int camss_probe(struct platform_device *pdev)
camss->csid_num = 5;
camss->vfe_num = 5;
} else {
- ret = -EINVAL;
- goto err_free;
+ return -EINVAL;
}
camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
sizeof(*camss->csiphy), GFP_KERNEL);
- if (!camss->csiphy) {
- ret = -ENOMEM;
- goto err_free;
- }
+ if (!camss->csiphy)
+ return -ENOMEM;
camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
GFP_KERNEL);
- if (!camss->csid) {
- ret = -ENOMEM;
- goto err_free;
- }
+ if (!camss->csid)
+ return -ENOMEM;
if (camss->version == CAMSS_8x16 ||
camss->version == CAMSS_8x96) {
camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
- if (!camss->ispif) {
- ret = -ENOMEM;
- goto err_free;
- }
+ if (!camss->ispif)
+ return -ENOMEM;
}
camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
GFP_KERNEL);
- if (!camss->vfe) {
- ret = -ENOMEM;
- goto err_free;
- }
+ if (!camss->vfe)
+ return -ENOMEM;
v4l2_async_nf_init(&camss->notifier);
@@ -1909,8 +1900,6 @@ static int camss_probe(struct platform_device *pdev)
v4l2_device_unregister(&camss->v4l2_dev);
err_cleanup:
v4l2_async_nf_cleanup(&camss->notifier);
-err_free:
- kfree(camss);
return ret;
}
@@ -1929,8 +1918,6 @@ void camss_delete(struct camss *camss)
device_link_del(camss->genpd_link[i]);
dev_pm_domain_detach(camss->genpd[i], true);
}
-
- kfree(camss);
}
/*
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: camss: Allocate camss struct as a managed device resource
2022-05-13 8:05 [PATCH] media: camss: Allocate camss struct as a managed device resource Vladimir Zapolskiy
@ 2022-05-18 18:46 ` Robert Foss
2022-05-18 19:21 ` Vladimir Zapolskiy
0 siblings, 1 reply; 3+ messages in thread
From: Robert Foss @ 2022-05-18 18:46 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: Todor Tomov, Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
linux-media, linux-arm-msm
Hey Vladimir,
On Fri, 13 May 2022 at 10:05, Vladimir Zapolskiy
<vladimir.zapolskiy@linaro.org> wrote:
>
> The change simplifies driver's probe and remove functions, no functional
> change is intended.
>
> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> ---
> The change is supposed to be applied on top of this one:
>
> https://lore.kernel.org/linux-media/20220512082318.189398-1-vladimir.zapolskiy@linaro.org/
>
> drivers/media/platform/qcom/camss/camss.c | 33 +++++++----------------
> 1 file changed, 10 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index e90fea28ac88..0f4908fa21e2 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -1751,7 +1751,7 @@ static int camss_probe(struct platform_device *pdev)
> struct camss *camss;
> int num_subdevs, ret;
>
> - camss = kzalloc(sizeof(*camss), GFP_KERNEL);
> + camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL);
> if (!camss)
> return -ENOMEM;
>
> @@ -1795,39 +1795,30 @@ static int camss_probe(struct platform_device *pdev)
> camss->csid_num = 5;
> camss->vfe_num = 5;
> } else {
> - ret = -EINVAL;
> - goto err_free;
> + return -EINVAL;
> }
>
> camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
> sizeof(*camss->csiphy), GFP_KERNEL);
> - if (!camss->csiphy) {
> - ret = -ENOMEM;
> - goto err_free;
> - }
> + if (!camss->csiphy)
> + return -ENOMEM;
>
> camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
> GFP_KERNEL);
> - if (!camss->csid) {
> - ret = -ENOMEM;
> - goto err_free;
> - }
> + if (!camss->csid)
> + return -ENOMEM;
>
> if (camss->version == CAMSS_8x16 ||
> camss->version == CAMSS_8x96) {
> camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
> - if (!camss->ispif) {
> - ret = -ENOMEM;
> - goto err_free;
> - }
> + if (!camss->ispif)
> + return -ENOMEM;
> }
>
> camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
> GFP_KERNEL);
> - if (!camss->vfe) {
> - ret = -ENOMEM;
> - goto err_free;
> - }
> + if (!camss->vfe)
> + return -ENOMEM;
>
> v4l2_async_nf_init(&camss->notifier);
>
> @@ -1909,8 +1900,6 @@ static int camss_probe(struct platform_device *pdev)
> v4l2_device_unregister(&camss->v4l2_dev);
> err_cleanup:
> v4l2_async_nf_cleanup(&camss->notifier);
> -err_free:
> - kfree(camss);
>
> return ret;
> }
> @@ -1929,8 +1918,6 @@ void camss_delete(struct camss *camss)
> device_link_del(camss->genpd_link[i]);
> dev_pm_domain_detach(camss->genpd[i], true);
> }
> -
> - kfree(camss);
> }
>
> /*
> --
> 2.33.0
>
I'm having issues applying this patch to upstream/master or
upstream-media/master, even when first applying the patch you
mentioned above.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: camss: Allocate camss struct as a managed device resource
2022-05-18 18:46 ` Robert Foss
@ 2022-05-18 19:21 ` Vladimir Zapolskiy
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2022-05-18 19:21 UTC (permalink / raw)
To: Robert Foss
Cc: Todor Tomov, Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
linux-media, linux-arm-msm
Hi Robert,
On 5/18/22 21:46, Robert Foss wrote:
> Hey Vladimir,
>
> On Fri, 13 May 2022 at 10:05, Vladimir Zapolskiy
> <vladimir.zapolskiy@linaro.org> wrote:
>>
>> The change simplifies driver's probe and remove functions, no functional
>> change is intended.
>>
>> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
>> ---
>> The change is supposed to be applied on top of this one:
>>
>> https://lore.kernel.org/linux-media/20220512082318.189398-1-vladimir.zapolskiy@linaro.org/
>>
>> drivers/media/platform/qcom/camss/camss.c | 33 +++++++----------------
>> 1 file changed, 10 insertions(+), 23 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
>> index e90fea28ac88..0f4908fa21e2 100644
>> --- a/drivers/media/platform/qcom/camss/camss.c
>> +++ b/drivers/media/platform/qcom/camss/camss.c
>> @@ -1751,7 +1751,7 @@ static int camss_probe(struct platform_device *pdev)
>> struct camss *camss;
>> int num_subdevs, ret;
>>
>> - camss = kzalloc(sizeof(*camss), GFP_KERNEL);
>> + camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL);
>> if (!camss)
>> return -ENOMEM;
>>
>> @@ -1795,39 +1795,30 @@ static int camss_probe(struct platform_device *pdev)
>> camss->csid_num = 5;
>> camss->vfe_num = 5;
>> } else {
>> - ret = -EINVAL;
>> - goto err_free;
>> + return -EINVAL;
>> }
>>
>> camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
>> sizeof(*camss->csiphy), GFP_KERNEL);
>> - if (!camss->csiphy) {
>> - ret = -ENOMEM;
>> - goto err_free;
>> - }
>> + if (!camss->csiphy)
>> + return -ENOMEM;
>>
>> camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
>> GFP_KERNEL);
>> - if (!camss->csid) {
>> - ret = -ENOMEM;
>> - goto err_free;
>> - }
>> + if (!camss->csid)
>> + return -ENOMEM;
>>
>> if (camss->version == CAMSS_8x16 ||
>> camss->version == CAMSS_8x96) {
>> camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
>> - if (!camss->ispif) {
>> - ret = -ENOMEM;
>> - goto err_free;
>> - }
>> + if (!camss->ispif)
>> + return -ENOMEM;
>> }
>>
>> camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
>> GFP_KERNEL);
>> - if (!camss->vfe) {
>> - ret = -ENOMEM;
>> - goto err_free;
>> - }
>> + if (!camss->vfe)
>> + return -ENOMEM;
>>
>> v4l2_async_nf_init(&camss->notifier);
>>
>> @@ -1909,8 +1900,6 @@ static int camss_probe(struct platform_device *pdev)
>> v4l2_device_unregister(&camss->v4l2_dev);
>> err_cleanup:
>> v4l2_async_nf_cleanup(&camss->notifier);
>> -err_free:
>> - kfree(camss);
>>
>> return ret;
>> }
>> @@ -1929,8 +1918,6 @@ void camss_delete(struct camss *camss)
>> device_link_del(camss->genpd_link[i]);
>> dev_pm_domain_detach(camss->genpd[i], true);
>> }
>> -
>> - kfree(camss);
>> }
>>
>> /*
>> --
>> 2.33.0
>>
>
> I'm having issues applying this patch to upstream/master or
> upstream-media/master, even when first applying the patch you
> mentioned above.
you are right, there is a minor conflict in the second patch hunk...
Please let me know a preferred branch/tag to use as the base, and
I'll resend v2 of the change shortly, thank you in advance!
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-18 19:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 8:05 [PATCH] media: camss: Allocate camss struct as a managed device resource Vladimir Zapolskiy
2022-05-18 18:46 ` Robert Foss
2022-05-18 19:21 ` Vladimir Zapolskiy
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).