kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] pinctrl: intel: ensure error return ret is initialized
@ 2017-12-04 17:08 Colin King
  2017-12-04 17:23 ` Mika Westerberg
  2017-12-07  8:58 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-12-04 17:08 UTC (permalink / raw)
  To: Mika Westerberg, Heikki Krogerus, Linus Walleij, linux-gpio
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the (unlikely) event that community->ngpps is zero, or if every
gpp->gpio_base is less than zero, then an ininitialized value in
ret is returned by function intel_gpio_add_pin_ranges. Fix this by
ensuring ret is initialized to zero.  It's a moot point, but I think
it is worthwhile ensuring this corner case is fixed.

Detected by CoverityScan, CID#1462415 ("Uninitialized scalar variable")

Fixes: a60eac3239f0 ("pinctrl: intel: Allow custom GPIO base for pad groups")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 359800fcb951..96e73e30204e 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1083,7 +1083,7 @@ static struct irq_chip intel_gpio_irqchip = {
 static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
 				     const struct intel_community *community)
 {
-	int ret, i;
+	int ret = 0, i;
 
 	for (i = 0; i < community->ngpps; i++) {
 		const struct intel_padgroup *gpp = &community->gpps[i];
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] pinctrl: intel: ensure error return ret is initialized
  2017-12-04 17:08 [PATCH][next] pinctrl: intel: ensure error return ret is initialized Colin King
@ 2017-12-04 17:23 ` Mika Westerberg
  2017-12-07  8:58 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2017-12-04 17:23 UTC (permalink / raw)
  To: Colin King
  Cc: Heikki Krogerus, Linus Walleij, linux-gpio, kernel-janitors,
	linux-kernel

On Mon, Dec 04, 2017 at 05:08:15PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the (unlikely) event that community->ngpps is zero, or if every
> gpp->gpio_base is less than zero, then an ininitialized value in
> ret is returned by function intel_gpio_add_pin_ranges. Fix this by
> ensuring ret is initialized to zero.  It's a moot point, but I think
> it is worthwhile ensuring this corner case is fixed.

I agree.

> Detected by CoverityScan, CID#1462415 ("Uninitialized scalar variable")
> 
> Fixes: a60eac3239f0 ("pinctrl: intel: Allow custom GPIO base for pad groups")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] pinctrl: intel: ensure error return ret is initialized
  2017-12-04 17:08 [PATCH][next] pinctrl: intel: ensure error return ret is initialized Colin King
  2017-12-04 17:23 ` Mika Westerberg
@ 2017-12-07  8:58 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-12-07  8:58 UTC (permalink / raw)
  To: Colin King
  Cc: Mika Westerberg, Heikki Krogerus, linux-gpio, kernel-janitors,
	linux-kernel@vger.kernel.org

On Mon, Dec 4, 2017 at 6:08 PM, Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
>
> In the (unlikely) event that community->ngpps is zero, or if every
> gpp->gpio_base is less than zero, then an ininitialized value in
> ret is returned by function intel_gpio_add_pin_ranges. Fix this by
> ensuring ret is initialized to zero.  It's a moot point, but I think
> it is worthwhile ensuring this corner case is fixed.
>
> Detected by CoverityScan, CID#1462415 ("Uninitialized scalar variable")
>
> Fixes: a60eac3239f0 ("pinctrl: intel: Allow custom GPIO base for pad groups")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied with Mika's ACK.

Thanks for running these Coverity scans.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-07  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 17:08 [PATCH][next] pinctrl: intel: ensure error return ret is initialized Colin King
2017-12-04 17:23 ` Mika Westerberg
2017-12-07  8:58 ` Linus Walleij

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).