From nobody Fri Jul 04 20:26:07 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX00ZMQz60lK6; Fri, 04 Jul 2025 20:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlWz4Rj9z3t6N; Fri, 04 Jul 2025 20:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjSZTmbUMBnOttEGIFTrFGqYacs80TpX9R9gPIuKzJQ=; b=UG5FPRW88pG36fSsYYBHDpHZ6jVi74c0EItdxgO5V4dr7i+qhmfFBJ4I09PIEL6j7XQEy6 Iymfu/RbanoMUwDeSiLrP/TZRu9jTQoiL4KBKwEbcXCLb0BZt51v2/N2mN5WtNwNQQraKB qOrW421lw0CYFESU2ScLql/DxKeEWmoEJXw/uHQ4Tj/hBUMktt6NDBV5zgogqK/uO15VHB fzGL7jnyET+zAw7tmWYqjqqgnqhGGInizHyBokzmLwt212vfIoP9hWerz6ozFsh+29vGIH w4x3rwRinlS0yo7QZkW/uhSARSEeEWsx6BxwD1o0LnvHqvfexi5cBftwarq1nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjSZTmbUMBnOttEGIFTrFGqYacs80TpX9R9gPIuKzJQ=; b=jh5HemmR2UBdzaOqQeaJwpub3sVgwC9XroL6OHfkBT1xLR84AEo6ConKPb1PfQbeNOAVVZ V23HKv5OULImbizRLhz8ueTWY5uf323INeDWxhjxTFZS8XrdHeyVEr5BMlIMvF6I4eGX8s dildG9KBXvB7pdW40hK/mBO5K6VsfsX+WRTr8ng5uF7EqRMz2CMN1R5vdpCO+ONNQ98pc0 F3WfGuPm0hKmSjTmkTPTFZULROI+Lhx4NpwpRKk9iaUq/4ka6Opb71HBOmNqraERg/QaNa dn8mmzcSd2m54sPpJxfqcf26HZINVixtRBFhxQ9u3SUkzDBb/sPaFPWe6UmiIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660767; a=rsa-sha256; cv=none; b=WXY/xv1+JnE8nIfnmaqx6ti+gyhqknC2E68xsXyq9yFW2z5QhN2DYfu5VIFGgjKthdlnZX lDrRJQtpTMeVvuddY/wBQZ2ktojxyAedFvnEaFRlykJ8m+NHmshXlI2QjcCujcWmIRXj6q bj7JfHCqvIRBzI+iaS5X579Oa6/Fd3EFz38RVVuWMMx64bschNtxetWO5hXQDXWlY03Myi 7cQ+MkS8yaRfmLfEGRQyWL9FyW4BprVrOePVnS1iwesM4Abla97f+jdOp0F5u6tR4ti/B6 yyR4uppY46pj5Xe5o7L+UYAPwMaWlTXDCRZtiKCtGk+P6V23QFKnIfZw01+13Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlWz42Bnz14cB; Fri, 04 Jul 2025 20:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQ73s096796; Fri, 4 Jul 2025 20:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQ79m096793; Fri, 4 Jul 2025 20:26:07 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:07 GMT Message-Id: <202507042026.564KQ79m096793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: a2bfb7cff243 - main - gpiobus: gpiobus_release_pin: convert errors to panic List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2bfb7cff243bdafebde5ea8629810fe507a2aea Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=a2bfb7cff243bdafebde5ea8629810fe507a2aea commit a2bfb7cff243bdafebde5ea8629810fe507a2aea Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:01:29 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiobus: gpiobus_release_pin: convert errors to panic These are programming errors. Suggested by: mmel Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50939 --- sys/dev/gpio/gpiobus.c | 21 ++++++++------------- sys/dev/gpio/gpiobusvar.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index ab849ca3db98..e919561340a8 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -415,7 +415,7 @@ gpiobus_acquire_pin(device_t bus, uint32_t pin) } /* Release mapped pin */ -int +void gpiobus_release_pin(device_t bus, uint32_t pin) { struct gpiobus_softc *sc; @@ -423,19 +423,15 @@ gpiobus_release_pin(device_t bus, uint32_t pin) sc = device_get_softc(bus); /* Consistency check. */ if (pin >= sc->sc_npins) { - device_printf(bus, - "invalid pin %d, max=%d\n", - pin, sc->sc_npins - 1); - return (-1); + panic("%s: invalid pin %d, max: %d", + device_get_nameunit(bus), pin, sc->sc_npins - 1); } - if (!sc->sc_pins[pin].mapped) { - device_printf(bus, "pin %d is not mapped\n", pin); - return (-1); - } - sc->sc_pins[pin].mapped = 0; + if (!sc->sc_pins[pin].mapped) + panic("%s: pin %d is not mapped", device_get_nameunit(bus), + pin); - return (0); + sc->sc_pins[pin].mapped = 0; } static int @@ -450,8 +446,7 @@ gpiobus_acquire_child_pins(device_t dev, device_t child) device_printf(child, "cannot acquire pin %d\n", devi->pins[i]); while (--i >= 0) { - (void)gpiobus_release_pin(dev, - devi->pins[i]); + gpiobus_release_pin(dev, devi->pins[i]); } gpiobus_free_ivars(devi); return (EBUSY); diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 3ae0767466c9..975788e84a83 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -182,7 +182,7 @@ int gpiobus_alloc_ivars(struct gpiobus_ivar *); void gpiobus_free_ivars(struct gpiobus_ivar *); int gpiobus_read_ivar(device_t, device_t, int, uintptr_t *); int gpiobus_acquire_pin(device_t, uint32_t); -int gpiobus_release_pin(device_t, uint32_t); +void gpiobus_release_pin(device_t, uint32_t); extern driver_t gpiobus_driver;