From: Rui Miguel Silva <rmfrfs@gmail.com>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: devel@driverdev.osuosl.org,
Philipp Zabel <p.zabel@pengutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Chuhong Yuan <hslester96@gmail.com>,
linux-kernel@vger.kernel.org, NXP Linux Team <linux-imx@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Steve Longerbeam <slongerbeam@gmail.com>,
Shawn Guo <shawnguo@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v2] media: imx7-mipi-csis: Add a check for devm_regulator_get
Date: Thu, 17 Oct 2019 10:43:59 +0100 [thread overview]
Message-ID: <m31rvbso4g.fsf@gmail.com> (raw)
In-Reply-To: <20191017081029.q2czy7y5zlbj4ogr@pengutronix.de>
Hi Marco,
On Thu 17 Oct 2019 at 09:10, Marco Felsch wrote:
> Hi Rui,
>
> On 19-10-16 14:43, Rui Miguel Silva wrote:
>> Hi Marco,
>> On Wed 16 Oct 2019 at 10:06, Marco Felsch wrote:
>> > Hi Chuhong,
>> >
>> > On 19-10-15 21:59, Chuhong Yuan wrote:
>> >> devm_regulator_get may return an error but mipi_csis_phy_init misses
>> >> a check for it.
>> >> This may lead to problems when regulator_set_voltage uses the unchecked
>> >> pointer.
>> >> This patch adds a check for devm_regulator_get to avoid potential risk.
>> >>
>> >> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
>> >> ---
>> >> Changes in v2:
>> >> - Add a check in mipi_csis_probe for the modified mipi_csis_phy_init.
>> >
>> > Did you miss the check for -EPROBE_DEFER?
>> >
>>
>> I think nothing special is really needed to do in case of
>> EPROBE_DEFER, or am I missing something?
>> It just return to probe and probe returns also. I just talked
>> about it because it was not cover in the original code.
>
> Yes, your are right... I shouldn't comment on anything I read with one
> eye. Sorry.
>
ehehe, no problem and thanks for your inputs.
---
Cheers,
Rui
>
> Regards,
> Marco
>
>> ---
>> Cheers,
>> Rui
>>
>> >
>> > Regards,
>> > Marco
>> >
>> >>
>> >> drivers/staging/media/imx/imx7-mipi-csis.c | 8 +++++++-
>> >> 1 file changed, 7 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
>> >> index 73d8354e618c..e8a6acaa969e 100644
>> >> --- a/drivers/staging/media/imx/imx7-mipi-csis.c
>> >> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
>> >> @@ -350,6 +350,8 @@ static void mipi_csis_sw_reset(struct csi_state *state)
>> >> static int mipi_csis_phy_init(struct csi_state *state)
>> >> {
>> >> state->mipi_phy_regulator = devm_regulator_get(state->dev, "phy");
>> >> + if (IS_ERR(state->mipi_phy_regulator))
>> >> + return PTR_ERR(state->mipi_phy_regulator);
>> >>
>> >> return regulator_set_voltage(state->mipi_phy_regulator, 1000000,
>> >> 1000000);
>> >> @@ -966,7 +968,10 @@ static int mipi_csis_probe(struct platform_device *pdev)
>> >> return ret;
>> >> }
>> >>
>> >> - mipi_csis_phy_init(state);
>> >> + ret = mipi_csis_phy_init(state);
>> >> + if (ret < 0)
>> >> + return ret;
>> >> +
>> >> mipi_csis_phy_reset(state);
>> >>
>> >> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> >> --
>> >> 2.20.1
>> >>
>> >>
>> >>
>>
>>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-10-17 9:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 13:59 [PATCH v2] media: imx7-mipi-csis: Add a check for devm_regulator_get Chuhong Yuan
2019-10-16 9:06 ` Marco Felsch
2019-10-16 13:43 ` Rui Miguel Silva
2019-10-17 8:10 ` Marco Felsch
2019-10-17 9:43 ` Rui Miguel Silva [this message]
2019-10-17 9:46 ` Rui Miguel Silva
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=m31rvbso4g.fsf@gmail.com \
--to=rmfrfs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hslester96@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=slongerbeam@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).