From: Krzysztof Kozlowski <krzk@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Tomasz Figa <tomasz.figa@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 05/12] pinctrl: samsung: Remove messages for failed memory allocation
Date: Mon, 16 Jan 2017 21:04:25 +0200 [thread overview]
Message-ID: <20170116190425.365vtjijrxggvwct@kozik-lap> (raw)
In-Reply-To: <1484549107-5957-6-git-send-email-m.szyprowski@samsung.com>
On Mon, Jan 16, 2017 at 07:45:00AM +0100, Marek Szyprowski wrote:
> Memory subsystem already prints message about failed memory
> allocation, there is no need to do it in the drivers.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/pinctrl/samsung/pinctrl-exynos.c | 8 ++------
> drivers/pinctrl/samsung/pinctrl-s3c64xx.c | 12 +++---------
> drivers/pinctrl/samsung/pinctrl-samsung.c | 24 ++++++------------------
> 3 files changed, 11 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
> index 24814db251a7..bf753a596209 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
> @@ -528,10 +528,8 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>
> weint_data = devm_kzalloc(dev, bank->nr_pins
> * sizeof(*weint_data), GFP_KERNEL);
> - if (!weint_data) {
> - dev_err(dev, "could not allocate memory for weint_data\n");
> + if (!weint_data)
> return -ENOMEM;
> - }
>
> for (idx = 0; idx < bank->nr_pins; ++idx) {
> irq = irq_of_parse_and_map(bank->of_node, idx);
> @@ -559,10 +557,8 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>
> muxed_data = devm_kzalloc(dev, sizeof(*muxed_data)
> + muxed_banks*sizeof(struct samsung_pin_bank *), GFP_KERNEL);
> - if (!muxed_data) {
> - dev_err(dev, "could not allocate memory for muxed_data\n");
> + if (!muxed_data)
> return -ENOMEM;
> - }
>
> irq_set_chained_handler_and_data(irq, exynos_irq_demux_eint16_31,
> muxed_data);
> diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
> index 4c632812ccff..f17890aa6e25 100644
> --- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
> +++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
> @@ -489,10 +489,8 @@ static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
>
> data = devm_kzalloc(dev, sizeof(*data)
> + nr_domains * sizeof(*data->domains), GFP_KERNEL);
> - if (!data) {
> - dev_err(dev, "failed to allocate handler data\n");
> + if (!data)
> return -ENOMEM;
> - }
> data->drvdata = d;
>
> bank = d->pin_banks;
> @@ -715,10 +713,8 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
> return -ENODEV;
>
> data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> - if (!data) {
> - dev_err(dev, "could not allocate memory for wkup eint data\n");
> + if (!data)
> return -ENOMEM;
> - }
> data->drvdata = d;
>
> for (i = 0; i < NUM_EINT0_IRQ; ++i) {
> @@ -751,10 +747,8 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
>
> ddata = devm_kzalloc(dev,
> sizeof(*ddata) + nr_eints, GFP_KERNEL);
> - if (!ddata) {
> - dev_err(dev, "failed to allocate domain data\n");
> + if (!ddata)
> return -ENOMEM;
> - }
> ddata->bank = bank;
>
> bank->irq_domain = irq_domain_add_linear(bank->of_node,
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index 3bc925f61b71..b11e67e85460 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -93,10 +93,8 @@ static int reserve_map(struct device *dev, struct pinctrl_map **map,
> return 0;
>
> new_map = krealloc(*map, sizeof(*new_map) * new_num, GFP_KERNEL);
> - if (!new_map) {
> - dev_err(dev, "krealloc(map) failed\n");
> + if (!new_map)
> return -ENOMEM;
> - }
>
> memset(new_map + old_num, 0, (new_num - old_num) * sizeof(*new_map));
>
> @@ -133,10 +131,8 @@ static int add_map_configs(struct device *dev, struct pinctrl_map **map,
>
> dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs),
> GFP_KERNEL);
> - if (!dup_configs) {
> - dev_err(dev, "kmemdup(configs) failed\n");
> + if (!dup_configs)
> return -ENOMEM;
> - }
>
> (*map)[*num_maps].type = PIN_MAP_TYPE_CONFIGS_GROUP;
> (*map)[*num_maps].data.configs.group_or_pin = group;
> @@ -156,10 +152,8 @@ static int add_config(struct device *dev, unsigned long **configs,
>
> new_configs = krealloc(*configs, sizeof(*new_configs) * new_num,
> GFP_KERNEL);
> - if (!new_configs) {
> - dev_err(dev, "krealloc(configs) failed\n");
> + if (!new_configs)
> return -ENOMEM;
> - }
>
> new_configs[old_num] = config;
>
> @@ -756,10 +750,8 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
>
> functions = devm_kzalloc(dev, func_cnt * sizeof(*functions),
> GFP_KERNEL);
> - if (!functions) {
> - dev_err(dev, "failed to allocate memory for function list\n");
> + if (!functions)
> return ERR_PTR(-EINVAL);
Out of scope of this patch - why are we returning EINVAL instead of
ENOMEM?
Regardless:
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
next prev parent reply other threads:[~2017-01-16 19:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170116064523eucas1p161a8e060b2883c076fc470ce7b522332@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Marek Szyprowski
[not found] ` <CGME20170116064523eucas1p18a55f951566df5ddd978364486154931@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 01/12] soc: samsung: pmu: Use common device name to let others to find it easily Marek Szyprowski
2017-01-16 19:48 ` Krzysztof Kozlowski
2017-01-17 4:39 ` Tomasz Figa
[not found] ` <CGME20170116064524eucas1p1fb1b3d080298b895d95bed106879255e@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 02/12] soc: samsung: pmu: Use of_device_get_match_data helper Marek Szyprowski
[not found] ` <CGME20170116064524eucas1p164e0f5bd1252e8599bf2570851772493@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 03/12] soc: samsung: pmu: Remove messages for failed memory allocation Marek Szyprowski
[not found] ` <CGME20170116064525eucas1p123df65dedceef6e3efe255e9a2ec6d07@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 04/12] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-16 19:01 ` Krzysztof Kozlowski
[not found] ` <CGME20170116064525eucas1p1556f795af7e2323726ca9a89943c7309@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 05/12] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-16 19:04 ` Krzysztof Kozlowski [this message]
[not found] ` <CGME20170116064526eucas1p1e3064fad71a3ab8de34d306dec531b14@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 06/12] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-16 19:14 ` Krzysztof Kozlowski
2017-01-17 4:44 ` Tomasz Figa
2017-01-17 6:34 ` Krzysztof Kozlowski
2017-01-17 7:13 ` Tomasz Figa
[not found] ` <CGME20170116064526eucas1p150c6653c9f1fac798ea79f6bee5631a1@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 07/12] pinctrl: samsung: Remove dead code Marek Szyprowski
[not found] ` <CGME20170116064527eucas1p1950a217ba6563a443bb44e8e87cc26b1@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 08/12] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-16 19:19 ` Krzysztof Kozlowski
[not found] ` <CGME20170116064527eucas1p1f0f78e9420e7d9d60d94b6e7381caeb1@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 09/12] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-16 19:37 ` Krzysztof Kozlowski
2017-01-17 4:51 ` Tomasz Figa
[not found] ` <CGME20170116064528eucas1p207c927835e33568e447c5a42ad18d0a7@eucas1p2.samsung.com>
2017-01-16 6:45 ` [PATCH 10/12] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
[not found] ` <CGME20170116064528eucas1p13b12a28ae9737404d38b3f794e8c23fd@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 11/12] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
[not found] ` <CGME20170116064529eucas1p15b04f901b17dfa2b02fd04745cbe3f17@eucas1p1.samsung.com>
2017-01-16 6:45 ` [PATCH 12/12] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-16 19:23 ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Krzysztof Kozlowski
2017-01-16 19:50 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170116190425.365vtjijrxggvwct@kozik-lap \
--to=krzk@kernel.org \
--cc=b.zolnierkie@samsung.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).