From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23C0417E46E; Sun, 1 Sep 2024 16:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725208765; cv=none; b=XgMn16aKVn2RbhPq2PsIuJ+40yXI+4F7KrWpm0FZbNXt1AHuXlfMYQV0P8ofKsO2DX4DGv5n4vgID+aIiq6DqlAR/i0gxlP82NBuus0IVlF73CdP4Bt1jlRkEeYFO6ppk/SZPBgRhjTxsCpxj+c9c1hWhNoAGghEiAJqUPxZZUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725208765; c=relaxed/simple; bh=jF/kgPXt0PU+ZfPsHDWF1TNjabulZl9rxlpf4inPgTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hwcpxZh4GxPA24mC8EimqPCoWXDMD6fkCITUNKZew9t0qe9zeXpXoMaXaQXLCfG2N0BFU3brrkaJs0gapmdT5K/xXmvymfJlOWg5Qh6dzjRr5u/sYWS1VOZHpK11FSti+eJMJ6N0NG7y3OoPlhFBkaZsceB16v/xBnOhLRaWwHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kEEOayUe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kEEOayUe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6118DC4CEC3; Sun, 1 Sep 2024 16:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725208765; bh=jF/kgPXt0PU+ZfPsHDWF1TNjabulZl9rxlpf4inPgTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kEEOayUejXAuyanS6wXBt5X87bmo2+dTV226gVG3ZFvR7YWQrYnMs7RLp2whC1rut TjnjmOj74TdqoojSaCoetMJfzp1kEQQKA7Uuy6oU93mz90yDlMEN5h4ICl4th1JIDz 1mqtEhdjxSGSSa31/96tvbn/rHhhe0bsvfUJyA9Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wolfram Sang , Geert Uytterhoeven , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 033/134] i2c: riic: avoid potential division by zero Date: Sun, 1 Sep 2024 18:16:19 +0200 Message-ID: <20240901160811.351538375@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160809.752718937@linuxfoundation.org> References: <20240901160809.752718937@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wolfram Sang [ Upstream commit 7890fce6201aed46d3576e3d641f9ee5c1f0e16f ] Value comes from DT, so it could be 0. Unlikely, but could be. Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-riic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 800414886f6b5..588a3efb09c26 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -312,7 +312,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) * frequency with only 62 clock ticks max (31 high, 31 low). * Aim for a duty of 60% LOW, 40% HIGH. */ - total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz); + total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz ?: 1); for (cks = 0; cks < 7; cks++) { /* -- 2.43.0