Discussion:
[PATCH 2/2] chipidea: ci_hdrc_imx.c: Remove unneeded OOM message
Fabio Estevam
2014-10-13 02:26:34 UTC
Permalink
From: Fabio Estevam <fabio.estevam-***@public.gmane.org>

MM core code already complains when devm_kzalloc() fails, so no need to print
the error locally.

Signed-off-by: Fabio Estevam <fabio.estevam-***@public.gmane.org>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index a7ab0f1..74b5b09 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -115,10 +115,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data;

data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- if (!data) {
- dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n");
+ if (!data)
return -ENOMEM;
- }

data->usbmisc_data = usbmisc_get_init_data(&pdev->dev);
if (IS_ERR(data->usbmisc_data))
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Peter Chen
2014-10-13 05:53:49 UTC
Permalink
Post by Fabio Estevam
MM core code already complains when devm_kzalloc() fails, so no need to print
the error locally.
For the title: you may need to add "usb" first. "usb: chipdea: xxx".
Besides, would you show me where the MM core code to do that?
Post by Fabio Estevam
---
drivers/usb/chipidea/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3df5005..c59929a 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -589,10 +589,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return PTR_ERR(base);
ci = devm_kzalloc(dev, sizeof(*ci), GFP_KERNEL);
- if (!ci) {
- dev_err(dev, "can't allocate device\n");
+ if (!ci)
return -ENOMEM;
- }
ci->dev = dev;
ci->platdata = dev_get_platdata(dev);
--
1.9.1
--
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Fabio Estevam
2014-10-13 11:58:14 UTC
Permalink
Post by Peter Chen
Post by Fabio Estevam
MM core code already complains when devm_kzalloc() fails, so no need to print
the error locally.
For the title: you may need to add "usb" first. "usb: chipdea: xxx".
Ok, will do it in v2.
Post by Peter Chen
Besides, would you show me where the MM core code to do that?
Please check the following commit for a better explanation:

commit ebfdc40969f24fc0cdd1349835d36e8ebae05374
Author: Joe Perches <joe-***@public.gmane.org>
Date: Wed Aug 6 16:10:27 2014 -0700

checkpatch: attempt to find unnecessary 'out of memory' messages
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...