* Re: [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail
[not found] <1381923650-7556-1-git-send-email-manishv.b@ti.com>
@ 2013-10-16 13:24 ` Nishanth Menon
2013-10-16 14:24 ` Manish Badarkhe
0 siblings, 1 reply; 3+ messages in thread
From: Nishanth Menon @ 2013-10-16 13:24 UTC (permalink / raw)
To: Vishwanathrao Badarkhe, Manish, linux-pm, linux-kernel,
linux-omap
Cc: khilman, anton, dwmw2
On 10/16/2013 06:40 AM, Vishwanathrao Badarkhe, Manish wrote:
> From: "Vishwanathrao Badarkhe, Manish" <manishv.b@ti.com>
>
> Currently, probe returns success(0) on "debugfs_create_dir"
> function call failed. Return proper error on "debugfs_create_dir"
> call failed.
>
> Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
> ---
> Not tested on any EVM. Bug has been found while doing static review.
> Please confirm.
IMHO, fail of creation of debugfs is not reason enough to fail the
probe - further, this code needs a major revamp to work with device tree.
>
> :100644 100644 db9973b... 7b101c1... M drivers/power/avs/smartreflex.c
> drivers/power/avs/smartreflex.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> index db9973b..7b101c1 100644
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -921,7 +921,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
> if (!sr_dbg_dir) {
> sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
> if (IS_ERR_OR_NULL(sr_dbg_dir)) {
> - ret = PTR_ERR(sr_dbg_dir);
> + ret = sr_dbg_dir ? PTR_ERR(sr_dbg_dir) : -EIO;
> pr_err("%s:sr debugfs dir creation failed(%d)\n",
> __func__, ret);
> goto err_list_del;
> @@ -932,7 +932,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
> if (IS_ERR_OR_NULL(sr_info->dbg_dir)) {
> dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
> __func__);
> - ret = PTR_ERR(sr_info->dbg_dir);
> + ret = sr_info->dbg_dir ? PTR_ERR(sr_info->dbg_dir) : -EIO;
> goto err_debugfs;
> }
>
> @@ -947,7 +947,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
> if (IS_ERR_OR_NULL(nvalue_dir)) {
> dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
> "for n-values\n", __func__);
> - ret = PTR_ERR(nvalue_dir);
> + ret = nvalue_dir ? PTR_ERR(nvalue_dir) : -EIO;
> goto err_debugfs;
> }
>
>
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail
2013-10-16 13:24 ` [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail Nishanth Menon
@ 2013-10-16 14:24 ` Manish Badarkhe
2013-10-16 14:43 ` Nishanth Menon
0 siblings, 1 reply; 3+ messages in thread
From: Manish Badarkhe @ 2013-10-16 14:24 UTC (permalink / raw)
To: Nishanth Menon
Cc: Vishwanathrao Badarkhe, Manish, linux-pm,
linux-kernel@vger.kernel.org, linux-omap, khilman,
Anton Vorontsov, David Woodhouse
Hi Nishanth
On Wed, Oct 16, 2013 at 6:54 PM, Nishanth Menon <nm@ti.com> wrote:
> On 10/16/2013 06:40 AM, Vishwanathrao Badarkhe, Manish wrote:
>> From: "Vishwanathrao Badarkhe, Manish" <manishv.b@ti.com>
>>
>> Currently, probe returns success(0) on "debugfs_create_dir"
>> function call failed. Return proper error on "debugfs_create_dir"
>> call failed.
>>
>> Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
>> ---
>> Not tested on any EVM. Bug has been found while doing static review.
>> Please confirm.
>
>
> IMHO, fail of creation of debugfs is not reason enough to fail the
> probe - further, this code needs a major revamp to work with device tree.
Yes, fail of debugfs creation should not be enough reason to fail probe. But as
per current implementation of code, on debugfs failure smart reflex node is
getting deleted and probe get failed. This patch not made any changes in
logic of code but only makes proper use of "IS_ERR_OR_NULL".
>> :100644 100644 db9973b... 7b101c1... M drivers/power/avs/smartreflex.c
>> drivers/power/avs/smartreflex.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
>> index db9973b..7b101c1 100644
>> --- a/drivers/power/avs/smartreflex.c
>> +++ b/drivers/power/avs/smartreflex.c
>> @@ -921,7 +921,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>> if (!sr_dbg_dir) {
>> sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
>> if (IS_ERR_OR_NULL(sr_dbg_dir)) {
>> - ret = PTR_ERR(sr_dbg_dir);
>> + ret = sr_dbg_dir ? PTR_ERR(sr_dbg_dir) : -EIO;
>> pr_err("%s:sr debugfs dir creation failed(%d)\n",
>> __func__, ret);
>> goto err_list_del;
>> @@ -932,7 +932,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>> if (IS_ERR_OR_NULL(sr_info->dbg_dir)) {
>> dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
>> __func__);
>> - ret = PTR_ERR(sr_info->dbg_dir);
>> + ret = sr_info->dbg_dir ? PTR_ERR(sr_info->dbg_dir) : -EIO;
>> goto err_debugfs;
>> }
>>
>> @@ -947,7 +947,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>> if (IS_ERR_OR_NULL(nvalue_dir)) {
>> dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
>> "for n-values\n", __func__);
>> - ret = PTR_ERR(nvalue_dir);
>> + ret = nvalue_dir ? PTR_ERR(nvalue_dir) : -EIO;
>> goto err_debugfs;
>> }
>>
Regards
Manish Baarkhe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail
2013-10-16 14:24 ` Manish Badarkhe
@ 2013-10-16 14:43 ` Nishanth Menon
0 siblings, 0 replies; 3+ messages in thread
From: Nishanth Menon @ 2013-10-16 14:43 UTC (permalink / raw)
To: Manish Badarkhe
Cc: Vishwanathrao Badarkhe, Manish, linux-pm,
linux-kernel@vger.kernel.org, linux-omap, khilman,
Anton Vorontsov, David Woodhouse
On Wed, Oct 16, 2013 at 9:24 AM, Manish Badarkhe
<badarkhe.manish@gmail.com> wrote:
>
>>
>> IMHO, fail of creation of debugfs is not reason enough to fail the
>> probe - further, this code needs a major revamp to work with device tree.
>
> Yes, fail of debugfs creation should not be enough reason to fail probe. But as
> per current implementation of code, on debugfs failure smart reflex node is
> getting deleted and probe get failed. This patch not made any changes in
> logic of code but only makes proper use of "IS_ERR_OR_NULL".
Thanks for the clarification, it was not obvious from the commit
message. Further, I would rather prefer to see a proper cleanup that
handles error completely, since IS_ERR_OR_NULL is not really
recommended anymore.
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-16 14:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1381923650-7556-1-git-send-email-manishv.b@ti.com>
2013-10-16 13:24 ` [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail Nishanth Menon
2013-10-16 14:24 ` Manish Badarkhe
2013-10-16 14:43 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox