From: Josua Mayer <josua@solid-run.com>
To: linux-media@vger.kernel.org
Cc: matrandg@cisco.com, mchehab@kernel.org,
dave.stevenson@raspberrypi.com, Josua Mayer <josua@solid-run.com>
Subject: [PATCH] media: tc358743: fix missing return of error code in tc358743_probe_of
Date: Tue, 22 Jun 2021 22:33:29 +0200 [thread overview]
Message-ID: <20210622203329.11608-1-josua@solid-run.com> (raw)
In-Reply-To: <427466e4-1b6f-f7c3-3d5e-89c7a7f2ec79@jm0.eu>
When device-tree configures an unsupported combinaion of number of lanes,
and link frequency, e.g. by exceeding 1Gbps per lane, 0 is returned,
wrongly indicating success. In this case, return EINVAL instead!
This fixes a divide-by-zero crash in tc358743_num_csi_lanes_needed,
where the divisor becomes zero because pll_fbd has been left at 0 by probe.
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
drivers/media/i2c/tc358743.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 1b309bb743c7..f21da11caf22 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1974,6 +1974,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
bps_pr_lane = 2 * endpoint.link_frequencies[0];
if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) {
dev_err(dev, "unsupported bps per lane: %u bps\n", bps_pr_lane);
+ ret = -EINVAL;
goto disable_clk;
}
--
2.32.0
next prev parent reply other threads:[~2021-06-22 20:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 15:07 [BUG] tc358743: division by zero Ing. Josua Mayer
2021-06-09 15:08 ` Ing. Josua Mayer
2021-06-09 17:08 ` Ing. Josua Mayer
2021-06-09 17:27 ` Dave Stevenson
2021-06-21 14:58 ` Ing. Josua Mayer
2021-06-22 20:33 ` Josua Mayer [this message]
2021-06-23 10:05 ` [PATCH] media: tc358743: fix missing return of error code in tc358743_probe_of Dave Stevenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210622203329.11608-1-josua@solid-run.com \
--to=josua@solid-run.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=linux-media@vger.kernel.org \
--cc=matrandg@cisco.com \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox