From: Axel Haslam <ahaslam@baylibre.com> To: tony@atomide.com, haojian.zhuang@linaro.org, linus.walleij@linaro.org, khilman@baylibre.com, nsekhar@ti.com Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Axel Haslam <ahaslam@baylibre.com> Subject: [PATCH] pinctrl: single: check for any error when getting rows Date: Wed, 9 Nov 2016 15:17:06 +0100 [thread overview] Message-ID: <20161109141706.12624-1-ahaslam@baylibre.com> (raw) pinctrl_count_index_with_args returns -ENOENT not -EINVAL. The return check would pass, and we would try to kzalloc with a negative error size throwing a warning. Instead of checking for -EINVAL specifically, lets check for any error and avoid negative size allocations. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> --- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 539f31c..56e22be 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1228,7 +1228,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, struct pcs_function *function; rows = pinctrl_count_index_with_args(np, name); - if (rows == -EINVAL) + if (rows < 0) return rows; npins_in_row = pcs->width / pcs->bits_per_pin; -- 2.10.1
WARNING: multiple messages have this Message-ID (diff)
From: ahaslam@baylibre.com (Axel Haslam) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] pinctrl: single: check for any error when getting rows Date: Wed, 9 Nov 2016 15:17:06 +0100 [thread overview] Message-ID: <20161109141706.12624-1-ahaslam@baylibre.com> (raw) pinctrl_count_index_with_args returns -ENOENT not -EINVAL. The return check would pass, and we would try to kzalloc with a negative error size throwing a warning. Instead of checking for -EINVAL specifically, lets check for any error and avoid negative size allocations. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> --- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 539f31c..56e22be 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1228,7 +1228,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, struct pcs_function *function; rows = pinctrl_count_index_with_args(np, name); - if (rows == -EINVAL) + if (rows < 0) return rows; npins_in_row = pcs->width / pcs->bits_per_pin; -- 2.10.1
next reply other threads:[~2016-11-09 14:18 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-11-09 14:17 Axel Haslam [this message] 2016-11-09 14:17 ` [PATCH] pinctrl: single: check for any error when getting rows Axel Haslam 2016-11-09 15:19 ` Tony Lindgren 2016-11-09 15:19 ` Tony Lindgren
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=20161109141706.12624-1-ahaslam@baylibre.com \ --to=ahaslam@baylibre.com \ --cc=haojian.zhuang@linaro.org \ --cc=khilman@baylibre.com \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=nsekhar@ti.com \ --cc=tony@atomide.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.