From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 63747355F5B for ; Mon, 16 Mar 2026 08:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773649194; cv=none; b=CFW3xCmMUimpDzYu83QxyGO03IdMXxBc4CEwE6KS2zrT2Or9BjDzo9SFiH0pvxeNNC6TX+1Z+1kSc3ZDnqShJsahs+ssM/gUT5+GJ8PA6dQacAgwKdi9XgXzJyysuq4ffyFzfe715qyaR7QblSvyi7GPYlcoj62Piux6WTWPHEI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773649194; c=relaxed/simple; bh=QAe0qOQULSDijy/Rdlguz/CCtwcyMqYCTdDDl3/BTcc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nsFWR7uK8ZbezTjnqrdWA5/sY5+7xNvU8waB8QBg7APE5KPPZoLSoAPWm1Gcv3t9OFHfH6y5LxJDymgrrjT2y8BRdPnbMWBrWlttbM4hLNQVgMOhM1RW213DJc+Ug49SAQ31dL3s36n3B3901XwPSxMUNMvPLEXq0viSSqSf+ws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PrSJFnRA; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PrSJFnRA" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4853aec185aso34865145e9.1 for ; Mon, 16 Mar 2026 01:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773649192; x=1774253992; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=NebB9FX++Sl8vrkNbafXiRbZn2hJyPCLF4EcIHgo1GE=; b=PrSJFnRAJMyoDbAsYRb2IIPm5Xht0u1E/ZQ+v/uroEpQiqanU4vFIfVDn0h6WGoPsB q037pIJVLVLY94hYUal4Fm4mmnC+maJ79xQ8PTgssVEsLhzEs/17VxdxG4V190Oblf+/ M3Lv965iWqYdpcnnxKVaJcM7jab70NXlI84kphJNOl8athx23DYq1Y8eV7sIu7uXCDpj u3JHyMwunuBbF9/+s9Ww1NrtRuTwR5/CZjxf6l2r+iWYg7pM4ovX6VQt6XfLygOo+0Hi Wmb94V74KZ7dUwnqoJwZr6gSR7U/CwqTlEs19PVeULROAezY1F5setAIIFSD/lzq8uIU w3MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773649192; x=1774253992; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NebB9FX++Sl8vrkNbafXiRbZn2hJyPCLF4EcIHgo1GE=; b=Bxh3tnnSaL/HlIOqwg26m6MP+DWmC4AlEEjqcd0COe3jj3WJ7FcnxDD4V3Izf+GRUG Ceg6DYljYtjzfl7/+mW3odWjLYHWDHFc7Sa83sAp/KX/cWmpfsRgKienY1mKZ+5O6R/s DPKhqwkT69QxGVRiKBW4hCDW0pBb0iKtvu9oPEAS+EXKgCGvnAinDbonxpv/USg4ZfLl ZG3rGWDRAIYfTuyoxMj/oDhNwRDj0v0OyTb+gHQBiEiVEHhbBe7en12kgvKwkI+/mrNJ x90nvTaZxVP+q780TZwwjBb19rNks/sShlKOfPf3nJkKdS0GiHOxQCSp24v9/CKGHVgj GWow== X-Forwarded-Encrypted: i=1; AJvYcCXP3UPbTyC7WsXMoABx5Kx0wM/5rAQ/qoWeRNeVlFem3sXExSSThgxCQmn6agOe9rdc0JDsuJ9xB6EZGNE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxoeb/QGRQ4gC9r0uciVSviA6jnhdW9HDHhYmJMUL4vwFWyd119 axM44FLg8MVXCZr3D/x190+AiEGVQ+nWZ3Rw0pkXUczufFIq0bMQz83/G2fVg9SSXd8= X-Gm-Gg: ATEYQzwP+dnleKo66KvSQxtE8d3xIGZGDOwukY+lDDck7ysqCVhsewVX1en+qzJcRKo i7hfQ2QqBgOkBmujwpCu00DZ/QU+NwtZYbKe3hzZVBv3QU4G+SDX9Y0Tewc/53/nsxcHuUDrRh+ 53jTGN2UmdMmMjLvvCW/2szYFh6o9c8yR2pugGGwiyFU0Trcq8+B0m9pA1z4XkWOJAIIRCMMBfV xXnM4RCt+fRW3G2M5eE7Y0WQ6PWoKvK7sNMBWR/7RxvKpvBrgycVwz+r9YPMgi0vaS/f92igbKn 338CvhKLDXamYuewc+Yh8NFeheOUxZtxftSkWUOTw0bKz4j/0OO+5LIC3aTS5v24WQvK/l+L3CU rl95CjBWDyB7Ay/GWU8byTNog63dqaC4clhJnPc/Cqb8WQI2U0KvFHbskvFhWXXrPHtVERtU9JT HOhfLqnYLdbh26fE4Oxxo7Jf6enkOp X-Received: by 2002:a05:600c:a46:b0:485:3bb5:92c5 with SMTP id 5b1f17b1804b1-485566d52c8mr210915185e9.14.1773649191735; Mon, 16 Mar 2026 01:19:51 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541ad1e4esm502929415e9.8.2026.03.16.01.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 01:19:51 -0700 (PDT) Date: Mon, 16 Mar 2026 11:19:48 +0300 From: Dan Carpenter To: Bera =?iso-8859-1?B?Wfx6bPw=?= Cc: gregkh@linuxfoundation.org, ethantidmore06@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8723bs: Improve error handling Message-ID: References: <20260313124908.579-2-b9788213@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260313124908.579-2-b9788213@gmail.com> On Fri, Mar 13, 2026 at 03:49:08PM +0300, Bera Yüzlü wrote: > Remove unnecessary ret variable and goto exit pattern. The function now > returns immediately when an error occurs. Additionally, ensure that > intf_free_irq() is called when pm_netdev_open() fails to avoid leaving > the allocated IRQ uncleared. > > Signed-off-by: Bera Yüzlü > --- > V2: Used int_free_irq() in error condition. > V1 Link: https://lore.kernel.org/linux-staging/20260312131933.29505-2-b9788213@gmail.com/ > drivers/staging/rtl8723bs/os_dep/os_intfs.c | 28 ++++++++------------- > 1 file changed, 10 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c > index 7ba689f2d..e86b8af8b 100644 > --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c > +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c > @@ -1124,35 +1124,28 @@ static int rtw_resume_process_normal(struct adapter *padapter) > struct pwrctrl_priv *pwrpriv; > struct mlme_priv *pmlmepriv; > > - int ret = _SUCCESS; > - > - if (!padapter) { > - ret = -1; > - goto exit; > - } > + if (!padapter) > + return -1; > > pnetdev = padapter->pnetdev; > pwrpriv = adapter_to_pwrctl(padapter); > pmlmepriv = &padapter->mlmepriv; > /* interface init */ > /* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */ > - if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) { > - ret = -1; > - goto exit; > - } > + if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) > + return -1; > + > rtw_hal_disable_interrupt(padapter); > /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) */ > - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { > - ret = -1; > - goto exit; > - } > + if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) > + return -1; I have written a howto on error handling. https://staticthinking.wordpress.com/2022/04/28/free-the-last-thing-style/ So after the ->intf_init() you need a deinit() etc. The blog hopefully explains. regards, dan carpenter