From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.117.254.33 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794133631; b=dDsMPGXPMJ5925UTyS4aoQQL4odLEYXg7IroqkIhLGNmo93Rirk1IUTc90HqyRj4vYAL Vhh81fZ6SV63dPtjmqnLXkmo4+EzQ+uLpOvhYuuJcwWVvIPLL3Boq+8h7xg8zidOzU+HW XfZTUvsMMHoUrFfIWTtpShER8ByxNppFAEC7yA6kI9DRPmFGWmbPBV8mwVIMaSSiZyR3B bBeNLcFI/ZSoBMqNXs5igxqB4tQZi1azCbRAYcDAAr15BfsN9ZlrU3Bb1MNyNVWPsZr5r neX2gWmVCCrcTI6KeYUWhcoDKKc+VD/HYKkMkVZpvKvm1MwDG944/C1PlJguHxt1jPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794133631; h=DMARC-Filter:DKIM-Signature:Received:Received:X-UD-Smtp-Session:Date: From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; bh=muKBTpgIwomUfoL+ebA1PuO9dc4a3sXML+kuNL0YxMc=; b=BovPvNyoOM3XmWiV04v9469eRNWln9sqgyiuT8jamCyCYc5U6BU2Py4jnZQetoMWF7Lk VqX1RSE7Jg+FxJFTJYyre+/aUYezYL5yLtq6RQrobPjk8AazLjLO/15r8u1LrO0LT61yy OMko2E3lp610zrK53hIgvhfkhpUV3Tmw7AxQI8FAZfSQR+bGEXXaxv6DbZp53ji1FEVEv HJ1P5vvcvjpyHKDFUzJq36ClKi+vqNxCOeUEpXiSZbjqg+y2vU/osoq5BFULp6VtN4WO6 puTTF91d2FeRPEztmLeNtWA7/3+OAO6mhOoJkdcrCEFR8rH+EHM+7ArgodhWk/ucdeQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass header.d=sang-engineering.com header.i=@sang-engineering.com header.a=rsa-sha256 header.s=k1 header.b=IwjcfgP9; arc=none smtp.remote-ip=194.117.254.33 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E47C3606A31C for ; Sun, 8 Nov 2026 10:27:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E47C3606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=sang-engineering.com header.i=@sang-engineering.com header.a=rsa-sha256 header.s=k1 header.b=IwjcfgP9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=k1; bh=muKBTpgIwomUfoL+ebA1PuO9dc4a3sXML+kuNL0Yx Mc=; b=IwjcfgP9iE46P2DVCrb8sqNBMdYcjPCP+KPKR5KgJZIcdkl2QaXc87hQ6 sp+ynLqDh6YI4nV3O/sH//uny4WjwTFNTxjflcWFA19CAYvu1xzgKBiV5rh7tQeU xYPW/YrgHJPaicHFEeSzlWD4Mp8B2M2d643TDPsSCQiIycpcrd3+E2DHKBTFzxgH ifisSvEKyK7l80w0ybuhVc9b/b79mY88dWUQPvalg0A6M87JZu0lvJ0rKJgTP3wh Ybo3SbY+Q8/7r9y4bzZ3danVSh1+z5qT7GKf7ezMEqvHg9hnpg4rYErjT1RZK/oU c1jdXwqloTmzQKHl7AGykEcnWZQGQ== Received: (qmail 2810692 invoked from network); 8 Nov 2026 11:27:07 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 8 Nov 2026 11:27:07 +0100 X-UD-Smtp-Session: l3s3148p1@tsR9ScFf1Ixe20rG Date: Sun, 8 Nov 2026 11:27:06 +0100 From: Wolfram Sang To: Linus Walleij Cc: Dmitry Guzman , Andi Shyti , srinidhi kasagar , Ben Dooks , Andrea Gallo , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] i2c: nomadik: handle pm_runtime errors Message-ID: References: <20261103-i2c-nomadik-fixes-v1-0-655c6af2cb70@mobileye.com> <20261103-i2c-nomadik-fixes-v1-6-655c6af2cb70@mobileye.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Nov 05, 2026 at 10:51:07AM +0200, Wolfram Sang wrote: > On Thu, Nov 05, 2026 at 09:42:02AM +0100, Linus Walleij wrote: > > On Tue, Nov 3, 2026 at 9:30 AM Dmitry Guzman wrote: > > > > > In nmk_i2c_xfer(), pm_runtime_get_sync() is called on start and then > > > the controller registers are accessed without checking the return value. > > > If pm_runtime_get_sync() fails, access to the register of the device that > > > was not correctly powered on may cause a bus fault or other unpredictable > > > system behavior. > > > > > > Check the return value of pm_runtime_get_sync() and it if is not 0, > > > return the error immediately. > > > > > > Signed-off-by: Dmitry Guzman > > (...) > > > - pm_runtime_get_sync(&priv->adev->dev); > > > + i = pm_runtime_get_sync(&priv->adev->dev); > > > + if (i) > > > + return i; > > > > It's a bit odd to reuse the i (= iterator...) variable for this. > > I would just add an int ret or int err for this. > > Yes, please. I changed this to: @@ -730,11 +730,12 @@ static int nmk_i2c_xfer_one(struct nmk_i2c_dev *priv, u16 flags) static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num_msgs) { - int status = 0; - int i; + int status, i; struct nmk_i2c_dev *priv = i2c_get_adapdata(i2c_adap); - pm_runtime_get_sync(&priv->adev->dev); + status = pm_runtime_get_sync(&priv->adev->dev); + if (status) + return status; /* setup the i2c controller */ setup_i2c_controller(priv); while applying.