From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 23C10235358 for ; Tue, 28 Apr 2026 08:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777365534; cv=none; b=sYPwHAVLCyF9kq8kL5rI6cUc3xPjbIzEViDL1Zd1jzu4e889cfoLU368M1VH/xU0pRZesw4QSsY64Mvm1JQnekWEQvWCd8AJeFkRzRDF+cgjpQkVauwPpgUDEF716TPj9SyfrWMUOTg+2d9AMsTGetOaGhgsSbfMJY2tVM1CO5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777365534; c=relaxed/simple; bh=i8cNe2bFSrRhvGyMu+xJd0eiViOt25sRua9gg/gI+RU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QM8zldbbZkgkTLmz6QwRFAo2ZIzU92nFVtt/ledAlS00pZlp6WlEVodJ9yJbK2T9sye8RuTJPS7AX5qs0NMKjCgMKt+cAhnpZ6uC1VNyYVEnzbgJ00mpLCDqFImXsAtMQD06dnCL2b0joB/8+PpWw45NveUAxylOQPo/b21cjec= 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=T+Tm+6q8; arc=none smtp.client-ip=209.85.128.49 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="T+Tm+6q8" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-48909558b3aso111388165e9.0 for ; Tue, 28 Apr 2026 01:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777365532; x=1777970332; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WC7zZ8VAa3K/6Sv1hAwfns6FqrYF808SVAq5ZPB5JYI=; b=T+Tm+6q8O57pAbvKPFKPGCkgTL9lSL093uLS2ursxqQreFBln//6MAdk9NfImuLbjI wQn9c21Nq6i6c123fXakDO3bt3egPAhgccSVbjRzukUFDI2Yf61HveZY9LOyvUyd8j5z K+Gloa3l2d4FtTeXFIQq4eEJy09DU6V62iKpwE40w+H6q1pRlPXy6lO36FvfN4PL6678 JAAnGyBLhpfXbu8RxnnvSBkQVUUlrq84aNYZQZ26YkfSzBF33V/A4i2lLpN1zqDGXH1m mQt5YhaW7UcRUIqdNj7qrB0PuPwN8Gpex0D0cQvK+sPhYIGE0610ji5/+ZGqGXCWYahc iLrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777365532; x=1777970332; h=in-reply-to: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=WC7zZ8VAa3K/6Sv1hAwfns6FqrYF808SVAq5ZPB5JYI=; b=onbgUDx7ywUhm3uXMZjXWLSNGY7pMiSAeSkl/4eVnZSayPrUijBJiy3lgmGtCzgTem 5GvmYveLENJqTgidkcd1bcaqgPKNz3B1+UU4PNMokV7FnA2hhhZ5P+K8bXkKa9qsMBo7 uyK7jjcn1G4vuy4VkVf2JP774h0e/c+N80MUHSULf/uvOzMnvZK60VgMZhyXh0ga4LJe pHjHVwHw+O4UbYcD595FzCnLcVIw4HqRxQJu+Gzwd4i3UnW4xYeAJzg6vEHPyRhM2fv3 LtiStl8cHZAXW7SeV7bGyvTN/5+3XI7WWttlOvCTJ0npZdBs/+ac1Ndbi6XY2vKNarcb slAQ== X-Forwarded-Encrypted: i=1; AFNElJ+GmSrls1RO+e9xt7rmUTvKtnrXC7mYCh+o8RaZ9bVJd20hs69ykVwT0uO/WcMQYCROyuni5oOFAZFBelg=@vger.kernel.org X-Gm-Message-State: AOJu0YywpPOg0634fWB9GLWT2uPdgo4079dVxU9mXQfBdCb4448hEqpH CYZPzMYu5EN7pg+FUZnEktgxx6Qmc5zuUJ3ooAXp1R6ffVYZDfJBsmK/ X-Gm-Gg: AeBDieuvQFXwG6AA8fqyZUQcz81pU5Wp/2aUDdmB1IANMxzlOu6kvmMTwTxMKjLBs7n ZAgRQiqXYHshbsqQ0tsCbA1PTPSLKBFt8rnBryqhHEqW5Bylh0LW4ySl5MIAWdMF8zac9Uwdsus ymmizbLkaX3IOACaZiZWhHAOImO+/05b5XHB+uGmA5IlA8AMk6yE5aydRWPF9rDF2phJnn66hW6 uiKfIlolHmYQ9WJ7JTKnnk05WdR+c+CgOR/uoI4nKpyq1vbe2uylusPk1jD3Fcokyv3bjaDv56q +frk+1q6OrwL8ITvFGtBOet0OmRPhY60C/wjpii1MpqMY5BrgmXs8RsVXsfZxt2V+2c+bJ2Aqvi GC5sfuft3z0HAYBpeJ2y7FInvF9Wt8vJxxqaX6LpsWNf5RrSPGCWBe7pVovw/0K58CgxnTK63tu WA5e/CZnpfBHQ1hArY8FxQg68= X-Received: by 2002:a05:600c:8b2f:b0:485:3b9e:caa7 with SMTP id 5b1f17b1804b1-48a77b19d6fmr35263695e9.23.1777365531329; Tue, 28 Apr 2026 01:38:51 -0700 (PDT) Received: from pc ([196.235.239.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a773b9b5dsm44928965e9.7.2026.04.28.01.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 01:38:50 -0700 (PDT) Date: Tue, 28 Apr 2026 09:38:47 +0100 From: Salah Triki To: Andy Shevchenko Cc: Crt Mori , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: mlx90614: fix missing GPIO direction return value checks Message-ID: References: <20260427215800.28082-1-salah.triki@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=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 28, 2026 at 11:00:04AM +0300, Andy Shevchenko wrote: > On Mon, Apr 27, 2026 at 10:58:00PM +0100, Salah Triki wrote: > > The functions gpiod_direction_output() and gpiod_direction_input() can > > fail, but their return values were previously ignored. > > > > If an error occurs during the GPIO configuration, the function should > > abort the wake-up sequence and return the error code. More importantly, > > failing to check these values could lead to the I2C bus remaining > > locked if an error occurs after i2c_lock_bus() is called. > > > > Add return value checks and ensure the I2C bus is properly unlocked > > via a goto label in case of failure. > > ... > > > - gpiod_direction_output(data->wakeup_gpio, 0); > > + > > + ret = gpiod_direction_output(data->wakeup_gpio, 0); > > + if (ret) > > + goto out_unlock; > > + > > msleep(chip_info->wakeup_delay_ms); > > - gpiod_direction_input(data->wakeup_gpio); > > + > > + ret = gpiod_direction_input(data->wakeup_gpio); > > + if (ret) > > + goto out_unlock; > > While technically it sounds correct, the potential problem here is that you may > fail this in case CONFIG_GPIOLIB=n. Is this GPIO optional? > What may happen if GPIO is not optional, but for some reason setting it fails? > > TL;DR: > I am not sure about this patch. At least I'm not comfortable to take it without > testing on real HW. > > -- > With Best Regards, > Andy Shevchenko > > Thank you for your feedback. Since I don't have the physical hardware to perform the necessary tests and ensure there are no regressions, I agree that it is safer to drop this patch. I don't want to risk breaking the driver for a minor cleanup. Best regards, -- Salah Triki