From: Evgeny Novikov <novikov@ispras.ru>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alex Dewar <alex.dewar90@gmail.com>,
Colin Ian King <colin.king@canonical.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: Re: [PATCH] media: atomisp: Fix error handling in probe
Date: Tue, 10 Aug 2021 18:36:59 +0300 [thread overview]
Message-ID: <528319d8-59d8-d3fa-3fa4-57bf2c1464e8@ispras.ru> (raw)
In-Reply-To: <20210810151427.GY1931@kadam>
Hi Dan,
Thank you for these suggestions. I will resend the patch.
Best regards,
Evgeny Novikov
On 10.08.2021 18:14, Dan Carpenter wrote:
> On Tue, Aug 10, 2021 at 02:53:03PM +0300, Evgeny Novikov wrote:
>> There were several issues with handling errors in lm3554_probe():
>> - Probe did not set the error code when v4l2_ctrl_handler_init() failed.
>> - It intermixed gotos for handling errors of v4l2_ctrl_handler_init()
>> and media_entity_pads_init().
>> - Probe did not free resources in case of failures of
>> atomisp_register_i2c_module().
>>
>> The patch fixes all these issues.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
> This patch is good, but two things:
>
> 1) Please can you rename all the labels to say what the goto does?
>
> err_uninit:
> lm3554_gpio_uninit(client);
> cleanup_media:
> media_entity_cleanup(&flash->sd.entity);
> free_handler:
> v4l2_ctrl_handler_free(&flash->ctrl_handler);
> unregister_subdev:
> v4l2_device_unregister_subdev(&flash->sd);
>
> 2) There is a missing error code still:
>
> drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> 858 if (ret) {
> 859 dev_err(&client->dev, "error initialize a ctrl_handler.\n");
> 860 goto fail3;
> 861 }
> 862
> 863 for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++)
> 864 v4l2_ctrl_new_custom(&flash->ctrl_handler, &lm3554_controls[i],
> 865 NULL);
> 866
> 867 if (flash->ctrl_handler.error) {
> 868 dev_err(&client->dev, "ctrl_handler error.\n");
> 869 goto fail3;
> ^^^^^^^^^^
> err = flash->ctrl_handler.error;
>
> 870 }
> 871
> 872 flash->sd.ctrl_handler = &flash->ctrl_handler;
> 873 err = media_entity_pads_init(&flash->sd.entity, 0, NULL);
> 874 if (err) {
> 875 dev_err(&client->dev, "error initialize a media entity.\n");
> 876 goto fail2;
> 877 }
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2021-08-10 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 11:53 Evgeny Novikov
2021-08-10 15:04 ` Sakari Ailus
2021-08-10 15:14 ` Dan Carpenter
2021-08-10 15:36 ` Evgeny Novikov [this message]
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=528319d8-59d8-d3fa-3fa4-57bf2c1464e8@ispras.ru \
--to=novikov@ispras.ru \
--cc=alex.dewar90@gmail.com \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=ldv-project@linuxtesting.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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
all inboxes | Powered by JetHome®