From: Sylwester Nawrocki <snjw23@gmail.com>
To: Subash Patel <subashrp@gmail.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
m.szyprowski@samsung.com, kyungmin.park@samsung.com,
sw0312.kim@samsung.com, riverful.kim@samsung.com
Subject: Re: [PATCH v3 08/19] s5p-fimc: Add the media device driver
Date: Fri, 22 Jul 2011 10:59:02 +0200 [thread overview]
Message-ID: <4E293BD6.2030502@gmail.com> (raw)
In-Reply-To: <4E291800.7060402@gmail.com>
Hi Subash,
On 07/22/2011 08:26 AM, Subash Patel wrote:
> Hi Sylwester,
>
> On 07/04/2011 11:24 PM, Sylwester Nawrocki wrote:
>> The fimc media device driver is hooked onto "s5p-fimc-md" platform device.
>> Such a platform device need to be added in a board initialization code
>> and then camera sensors need to be specified as it's platform data.
>> The "s5p-fimc-md" device is a top level entity for all FIMC, mipi-csis
>> and sensor devices.
>>
>> Signed-off-by: Sylwester Nawrocki<s.nawrocki@samsung.com>
>> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
>> ---
>> drivers/media/video/Kconfig | 2 +-
>> drivers/media/video/s5p-fimc/Makefile | 2 +-
> ...
>>
>> /* -----------------------------------------------------*/
>> /* fimc-capture.c */
>> diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c
>> new file mode 100644
>> index 0000000..10c8d5d
>> --- /dev/null
>> +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c
>> @@ -0,0 +1,804 @@
> ...
>> +
>> +static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
>> +{
>> + struct s5p_platform_fimc *pdata = fmd->pdev->dev.platform_data;
>> + struct fimc_dev *fd = NULL;
>> + int num_clients, ret, i;
>> +
>> + /*
>> + * Runtime resume one of the FIMC entities to make sure
>> + * the sclk_cam clocks are not globally disabled.
>> + */
>> + for (i = 0; !fd&& i< ARRAY_SIZE(fmd->fimc); i++)
>> + if (fmd->fimc[i])
>> + fd = fmd->fimc[i];
>> + if (!fd)
>> + return -ENXIO;
>> + ret = pm_runtime_get_sync(&fd->pdev->dev);
>> + if (ret< 0)
>> + return ret;
>> +
>> + WARN_ON(pdata->num_clients> ARRAY_SIZE(fmd->sensor));
>> + num_clients = min_t(u32, pdata->num_clients, ARRAY_SIZE(fmd->sensor));
>> +
>> + fmd->num_sensors = num_clients;
>> + for (i = 0; i< num_clients; i++) {
>> + fmd->sensor[i].pdata =&pdata->isp_info[i];
>> + ret = __fimc_md_set_camclk(fmd,&fmd->sensor[i], true);
>> + if (ret)
>> + break;
>> + fmd->sensor[i].subdev =
>> + fimc_md_register_sensor(fmd,&fmd->sensor[i]);
>
> There is an issue here. Function fimc_md_register_sensor(),
> can return subdev, as also error codes when i2c_get_adapter()
> or NULL when v4l2_i2c_new_subdev_board() fail. But we do not
> invalidate, and assume the return value is valid subdev. It
> will cause kernel NULL pointer exception later in fimc_md_create_links().
Thanks for letting know.
I remember fixing this issue in v2 of the patch set by making
fimc_md_register_sensor() return NULL on any error, also when
i2c_get_adapter() fails, rather than ERR_PTR value.
Do you really mean that there is a NULL or _invalid_ pointer
dereference in fimc_md_create_links() ?
An oops on a NULL subdev pointer in fmd->sensor[] array seems
impossible as there is a check at the beginning of the loop:
+static int fimc_md_create_links(struct fimc_md *fmd)
+{
+ struct v4l2_subdev *sensor, *csis;
+ struct s5p_fimc_isp_info *pdata;
+ struct fimc_sensor_info *s_info;
+ struct media_entity *source;
+ int fimc_id = 0;
+ int i, pad;
+ int rc = 0;
+
+ for (i = 0; i < fmd->num_sensors; i++) {
+ if (fmd->sensor[i].subdev == NULL)
+ continue;
...
Sorry, I'll be able to only make more test of this on Monday.
--
Thanks,
Sylwester
next prev parent reply other threads:[~2011-07-22 8:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-04 17:54 [PATCH v3 0/19] s5p-fimc driver conversion to media controller and control framework Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 01/19] s5p-fimc: Add support for runtime PM in the mem-to-mem driver Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 02/19] s5p-fimc: Add media entity initialization Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 03/19] s5p-fimc: Remove registration of video nodes from probe() Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 04/19] s5p-fimc: Remove sclk_cam clock handling Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 05/19] s5p-fimc: Limit number of available inputs to one Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 06/19] s5p-fimc: Remove sensor management code from FIMC capture driver Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 07/19] s5p-fimc: Remove v4l2_device from video capture and m2m driver Sylwester Nawrocki
2011-07-04 17:54 ` [PATCH v3 08/19] s5p-fimc: Add the media device driver Sylwester Nawrocki
2011-07-22 6:26 ` Subash Patel
2011-07-22 8:59 ` Sylwester Nawrocki [this message]
2011-07-22 9:26 ` Subash Patel
2011-07-22 10:14 ` Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 09/19] s5p-fimc: Conversion to use struct v4l2_fh Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 10/19] s5p-fimc: Conversion to the control framework Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 11/19] s5p-fimc: Add media operations in the capture entity driver Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 12/19] s5p-fimc: Add PM helper function for streaming control Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 13/19] s5p-fimc: Correct color format enumeration Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 14/19] s5p-fimc: Convert to use media pipeline operations Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 15/19] s5p-fimc: Add subdev for the FIMC processing block Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 16/19] s5p-fimc: Add support for camera capture in JPEG format Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 17/19] s5p-fimc: Add v4l2_device notification support for single frame capture Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 18/19] s5p-fimc: Use consistent names for the buffer list functions Sylwester Nawrocki
2011-07-04 17:55 ` [PATCH v3 19/19] s5p-fimc: Add runtime PM support in the camera capture driver Sylwester Nawrocki
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=4E293BD6.2030502@gmail.com \
--to=snjw23@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=riverful.kim@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=subashrp@gmail.com \
--cc=sw0312.kim@samsung.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