Unverified Commit 676ce157 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15363 gpiolib: Fix crash on error in gpiochip_get_ngpios()

parents 5e67a6f4 c4aea1aa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -723,12 +723,12 @@ int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev)
	}

	if (gc->ngpio == 0) {
		chip_err(gc, "tried to insert a GPIO chip with zero lines\n");
		dev_err(dev, "tried to insert a GPIO chip with zero lines\n");
		return -EINVAL;
	}

	if (gc->ngpio > FASTPATH_NGPIO)
		chip_warn(gc, "line cnt %u is greater than fast path cnt %u\n",
		dev_warn(dev, "line cnt %u is greater than fast path cnt %u\n",
			 gc->ngpio, FASTPATH_NGPIO);

	return 0;