From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
dmitry.baryshkov@linaro.org,
Loic Poulain <loic.poulain@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>,
Liao Chang <liaochang1@huawei.com>,
Todor Tomov <todor.too@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Vinod Koul <vkoul@kernel.org>, Wolfram Sang <wsa@kernel.org>,
linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
error27@gmail.com, vegard.nossum@oracle.com
Subject: Re: [PATCH next] i2c: qcom-cci: Fix error checking in cci_probe()
Date: Thu, 24 Aug 2023 10:10:20 +0100 [thread overview]
Message-ID: <bacbdd5e-0547-213e-407e-eabf4e84141d@linaro.org> (raw)
In-Reply-To: <20230823194202.2280957-1-harshit.m.mogalapalli@oracle.com>
On 23/08/2023 20:42, Harshit Mogalapalli wrote:
> devm_clk_bulk_get_all() can return zero when no clocks are obtained.
> Passing zero to dev_err_probe() is a success which is incorrect.
>
> Fixes: 605efbf43813 ("i2c: qcom-cci: Use dev_err_probe in probe function")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> Only compile tested, found by static analysis with smatch.
>
> https://lore.kernel.org/all/CAA8EJprTOjbOy7N5+8NiJaNNhK+_btdUUFcpHKPkMuCZj5umMA@mail.gmail.com/
> ^^ I reported initially here, Dmitry suggested we need to fix it in a
> different patch.
>
> the Fixes commit used above pointed this bug, but the real fixes tag is this:
> Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
> ---
> drivers/i2c/busses/i2c-qcom-cci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
> index cf13abec05f1..414882c57d7f 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -588,8 +588,10 @@ static int cci_probe(struct platform_device *pdev)
> /* Clocks */
>
> ret = devm_clk_bulk_get_all(dev, &cci->clocks);
> - if (ret < 1)
> + if (ret < 0)
> return dev_err_probe(dev, ret, "failed to get clocks\n");
> + else if (!ret)
> + return dev_err_probe(dev, -EINVAL, "not enough clocks in DT\n");
> cci->nclocks = ret;
>
> /* Retrieve CCI clock rate */
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2023-08-24 9:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 19:42 [PATCH next] i2c: qcom-cci: Fix error checking in cci_probe() Harshit Mogalapalli
2023-08-24 9:10 ` Bryan O'Donoghue [this message]
2023-08-24 16:11 ` Andi Shyti
2023-08-25 20:07 ` Wolfram Sang
2023-09-05 9:10 ` Dan Carpenter
2023-09-05 9:24 ` Harshit Mogalapalli
2023-09-05 10:25 ` Andi Shyti
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=bacbdd5e-0547-213e-407e-eabf4e84141d@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=andersson@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=error27@gmail.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=liaochang1@huawei.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=rfoss@kernel.org \
--cc=todor.too@gmail.com \
--cc=vegard.nossum@oracle.com \
--cc=vkoul@kernel.org \
--cc=wsa@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