From nobody Sat Feb 7 21:15:55 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5149070814 for ; Sat, 15 Nov 2025 06:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763187502; cv=none; b=QSumo3jIlXYjN+j7hbuyNWs9Hrj3y9lAuWp63LfuVw8fxXI1HW/JEuY+XSXm9pMm7dDEOyENO/GYF9aQOPFCETs/UNrxl6mO6LCGUfEufuJY1zG2Q4pkwi9ixNzYeFkvTKnRMM11HIPrr93JyXGcf4ABeukmRz/EwBJ4iqubuqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763187502; c=relaxed/simple; bh=NrEKsQoz0XxezEcop9klSosma97viVe+I9X0t+9NKwU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qNUag+kQ/quk/VOXyrrRsRL01g0y0TTcRiy4TyISCWvcugRkz6QDT1tiSylYMV7OP18H3MxOVJ/DLOZiIi5rNZVShAu/CszEdkkjU+VZU90h/c9vbTuLNpjiqLRP98+KFzd3hV5LC15ZQ/TWmItRkYpE1STcjlpJl3UGfYYXJz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R9DvZVrE; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R9DvZVrE" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7b8e49d8b35so3050418b3a.3 for ; Fri, 14 Nov 2025 22:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763187501; x=1763792301; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nR414HzuTWuhyNuPBPVh6HF0ByypEaKaxDXsS4YHm+8=; b=R9DvZVrECc7DJV+Iy+N95Gc4g9gATYbMo1qX/voS4Qaq2SWuGfsNZXsdWPOyMD2UzF UVLw0w9DxbFQwarBJSEjHFijukX0fRrCWUaxlWsoktUuFUE+AScFbb8Yi0JDzTdWmxLj RjN2eyNLmvE4zDJit8gildthiY/Pe0LcYu28HOUMz2LPNvAkiye0xsoQk1OJOQUkYNBE g5o12mK00fWrCNR1YIG256FshYvYzLNBWiAAGMQ1D55gKZfQF3taK0T4zILLeAPkbNMv kSoHTuOzTojp8KfWS0VgpFwoppgCzod20vC+bVQZiwSsmoLtPXySqosx9ZDZzpbVNOZE j2ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763187501; x=1763792301; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nR414HzuTWuhyNuPBPVh6HF0ByypEaKaxDXsS4YHm+8=; b=bHb1emmYEv9vLIVPEa8FAhvpMbQJ4sTOfbChmcX4UZS6/B5vJOwEDiGRiXZxPUUCtz YWnJ8usFhrJ+S6y/d4JAvqdls4m1WIjsg2NqF+Q/ybLq9EUdp0kpJeUzWCOiXZcSVfPw g7GFKcUoznb277JqlSnK0uDkURA+K4wwWkCQI8UUBDG3ubPkWXwqCiQ1aQe4dkD8kGE/ 9UnYjhod6IwDp2II6vryy8pF6iqsqd6WlUeOdTXcNSLysBBgRmBWfMJbvYrrzbLtP78e 2RcGMTFO4jQnPhGmbAwquhWYvPNezmTAxixzCcvOTdx6/2IkwPx48UEyN2cBEjUwcxr0 jYKA== X-Forwarded-Encrypted: i=1; AJvYcCWGkyczhaLlYdzFYlg7ECkT1O74chIgQAQojJuGLyQhywUMWEoYjMmLHwy01cMlOA5lWrXkfxNGXUU2bOQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwWGCKHa20fG/sAOw58Jy+CuTxRZ+7yhiqq+WW+FzXZD3MY7UDW 3UqX/1jWEuCEM0TQek4TPJ177ore/xobvzKztROG61epVHAnyuQ3YAcH X-Gm-Gg: ASbGncvzg6xotztlCiiPoiQS/CHq9irCPJZFA33gWZcQ7s0nUX5HW3bGcxq4j8EufVR u75ULCo0vN78CT9eT/EABujNlkpfeAsWxSEukAXx4+TNxXIBqX68toB2OxPyIiI529uA0Fw8q3p rFV8CIrlh+Ms8QUrHfRB75WqOrxxhloG6LVwEb2lo9inbASl3xc2v32Mhb/aRCiUqYWl7i6We1G 2NFqs3gnqbv3QFygtiBHS+WeSfHxT6DS7GtvpyhT0gHx/Qoa+VLmf2htGtfObxGh4vcfhX/vLD9 agopevvExRYP2rTEttPs73wG0btazCI1XOQzVj5tuJCCh5yU7+8/SbL37ayJVs42NUzcRCtk05y UDg/l2g7msubv3YjEHakngHfOUdw4y8kDxHZP8BFq6QWefP0PjH0iNFeZ5vFiCMlib6dxiNCDuK yftPtQF5WzeLYl4zgvqjwonR9iUp3L2usJbXIs9Q16KaqMm37uIsiXYqlVUpiCRGDws+ITq+ezY pWorLSbE0/D3ySklPcqhB9OhFk= X-Google-Smtp-Source: AGHT+IH1LjD90VbAPuNapbdjB5ZQKWZ42pc4Ga7VXQDXnVR8Okq/prv5bQKCJu1zSNjuVb+IId1/ug== X-Received: by 2002:a05:6a20:4315:b0:34e:e0ba:7ab with SMTP id adf61e73a8af0-35ba219576fmr7346436637.40.1763187500557; Fri, 14 Nov 2025 22:18:20 -0800 (PST) Received: from prakrititz-UB.. ([119.161.98.68]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7b9250d24b9sm6976265b3a.17.2025.11.14.22.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 22:18:20 -0800 (PST) From: Nirbhay Sharma To: David Lin , Johan Hovold , Greg Kroah-Hartman Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Shuah Khan , david.hunter.linux@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, Nirbhay Sharma Subject: [PATCH] staging: greybus: uart: check return values during probe Date: Sat, 15 Nov 2025 11:46:47 +0530 Message-ID: <20251115061646.160847-2-nirbhay.lkd@gmail.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check the return values of send_control() and send_line_coding() during device initialization in gb_uart_probe(). If these operations fail, the device will be left in an inconsistent state, so propagate the error to properly fail the probe. Both functions call gb_operation_sync() which can fail with errors such as -ENOMEM, -ENODEV, or -ETIMEDOUT. Ignoring these errors means the TTY device would be registered despite incomplete initialization. Signed-off-by: Nirbhay Sharma --- drivers/staging/greybus/uart.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 10df5c37c83e..5cece0a6606f 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -879,14 +879,18 @@ static int gb_uart_probe(struct gbphy_device *gbphy_d= ev, if (retval) goto exit_put_port; =20 - send_control(gb_tty, gb_tty->ctrlout); + retval =3D send_control(gb_tty, gb_tty->ctrlout); + if (retval) + goto exit_connection_disable; =20 /* initialize the uart to be 9600n81 */ gb_tty->line_coding.rate =3D cpu_to_le32(9600); gb_tty->line_coding.format =3D GB_SERIAL_1_STOP_BITS; gb_tty->line_coding.parity =3D GB_SERIAL_NO_PARITY; gb_tty->line_coding.data_bits =3D 8; - send_line_coding(gb_tty); + retval =3D send_line_coding(gb_tty); + if (retval) + goto exit_connection_disable; =20 retval =3D gb_connection_enable(connection); if (retval) --=20 2.48.1