* [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c
@ 2013-05-02 5:03 Sachin Kamat
2013-05-02 5:03 ` [PATCH v2 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Sachin Kamat
2013-05-02 10:23 ` [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sylwester Nawrocki
0 siblings, 2 replies; 3+ messages in thread
From: Sachin Kamat @ 2013-05-02 5:03 UTC (permalink / raw)
To: linux-media; +Cc: t.stanislaws, s.nawrocki, sachin.kamat, patches
NULL check on clocks obtained using common clock APIs should not
be done. Use IS_ERR only.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Changes since v1:
Initialised clocks to invalid value.
---
drivers/media/platform/s5p-tv/hdmi_drv.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 4e86626..ed1a695 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -765,15 +765,15 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev)
regulator_bulk_free(res->regul_count, res->regul_bulk);
/* kfree is NULL-safe */
kfree(res->regul_bulk);
- if (!IS_ERR_OR_NULL(res->hdmiphy))
+ if (!IS_ERR(res->hdmiphy))
clk_put(res->hdmiphy);
- if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
+ if (!IS_ERR(res->sclk_hdmiphy))
clk_put(res->sclk_hdmiphy);
- if (!IS_ERR_OR_NULL(res->sclk_pixel))
+ if (!IS_ERR(res->sclk_pixel))
clk_put(res->sclk_pixel);
- if (!IS_ERR_OR_NULL(res->sclk_hdmi))
+ if (!IS_ERR(res->sclk_hdmi))
clk_put(res->sclk_hdmi);
- if (!IS_ERR_OR_NULL(res->hdmi))
+ if (!IS_ERR(res->hdmi))
clk_put(res->hdmi);
memset(res, 0, sizeof(*res));
}
@@ -793,8 +793,14 @@ static int hdmi_resources_init(struct hdmi_device *hdev)
dev_dbg(dev, "HDMI resource init\n");
memset(res, 0, sizeof(*res));
- /* get clocks, power */
+ res->hdmi = ERR_PTR(-EINVAL);
+ res->sclk_hdmi = ERR_PTR(-EINVAL);
+ res->sclk_pixel = ERR_PTR(-EINVAL);
+ res->sclk_hdmiphy = ERR_PTR(-EINVAL);
+ res->hdmiphy = ERR_PTR(-EINVAL);
+
+ /* get clocks, power */
res->hdmi = clk_get(dev, "hdmi");
if (IS_ERR(res->hdmi)) {
dev_err(dev, "failed to get clock 'hdmi'\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c
2013-05-02 5:03 [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sachin Kamat
@ 2013-05-02 5:03 ` Sachin Kamat
2013-05-02 10:23 ` [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sylwester Nawrocki
1 sibling, 0 replies; 3+ messages in thread
From: Sachin Kamat @ 2013-05-02 5:03 UTC (permalink / raw)
To: linux-media; +Cc: t.stanislaws, s.nawrocki, sachin.kamat, patches
NULL check on clocks obtained using common clock APIs should not
be done. Use IS_ERR only.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Changes since v1:
Initialised clocks to invalid value.
---
drivers/media/platform/s5p-tv/mixer_drv.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c
index 5733033..506a5aa 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -222,15 +222,15 @@ static void mxr_release_clocks(struct mxr_device *mdev)
{
struct mxr_resources *res = &mdev->res;
- if (!IS_ERR_OR_NULL(res->sclk_dac))
+ if (!IS_ERR(res->sclk_dac))
clk_put(res->sclk_dac);
- if (!IS_ERR_OR_NULL(res->sclk_hdmi))
+ if (!IS_ERR(res->sclk_hdmi))
clk_put(res->sclk_hdmi);
- if (!IS_ERR_OR_NULL(res->sclk_mixer))
+ if (!IS_ERR(res->sclk_mixer))
clk_put(res->sclk_mixer);
- if (!IS_ERR_OR_NULL(res->vp))
+ if (!IS_ERR(res->vp))
clk_put(res->vp);
- if (!IS_ERR_OR_NULL(res->mixer))
+ if (!IS_ERR(res->mixer))
clk_put(res->mixer);
}
@@ -239,7 +239,14 @@ static int mxr_acquire_clocks(struct mxr_device *mdev)
struct mxr_resources *res = &mdev->res;
struct device *dev = mdev->dev;
- res->mixer = clk_get(dev, "mixer");
+
+ res->mixer = ERR_PTR(-EINVAL);
+ res->vp = ERR_PTR(-EINVAL);
+ res->sclk_mixer = ERR_PTR(-EINVAL);
+ res->sclk_hdmi = ERR_PTR(-EINVAL);
+ res->sclk_dac = ERR_PTR(-EINVAL);
+
+ res->mixer = clk_get(dev, "mixer");
if (IS_ERR(res->mixer)) {
mxr_err(mdev, "failed to get clock 'mixer'\n");
goto fail;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c
2013-05-02 5:03 [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sachin Kamat
2013-05-02 5:03 ` [PATCH v2 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Sachin Kamat
@ 2013-05-02 10:23 ` Sylwester Nawrocki
1 sibling, 0 replies; 3+ messages in thread
From: Sylwester Nawrocki @ 2013-05-02 10:23 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-media, t.stanislaws, patches
Hi Sachin,
On 05/02/2013 07:03 AM, Sachin Kamat wrote:
> NULL check on clocks obtained using common clock APIs should not
> be done. Use IS_ERR only.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Changes since v1:
> Initialised clocks to invalid value.
> ---
> drivers/media/platform/s5p-tv/hdmi_drv.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
> index 4e86626..ed1a695 100644
> --- a/drivers/media/platform/s5p-tv/hdmi_drv.c
> +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
> @@ -765,15 +765,15 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev)
> regulator_bulk_free(res->regul_count, res->regul_bulk);
> /* kfree is NULL-safe */
> kfree(res->regul_bulk);
> - if (!IS_ERR_OR_NULL(res->hdmiphy))
> + if (!IS_ERR(res->hdmiphy))
> clk_put(res->hdmiphy);
> - if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
> + if (!IS_ERR(res->sclk_hdmiphy))
> clk_put(res->sclk_hdmiphy);
> - if (!IS_ERR_OR_NULL(res->sclk_pixel))
> + if (!IS_ERR(res->sclk_pixel))
> clk_put(res->sclk_pixel);
> - if (!IS_ERR_OR_NULL(res->sclk_hdmi))
> + if (!IS_ERR(res->sclk_hdmi))
> clk_put(res->sclk_hdmi);
> - if (!IS_ERR_OR_NULL(res->hdmi))
> + if (!IS_ERR(res->hdmi))
> clk_put(res->hdmi);
> memset(res, 0, sizeof(*res));
Shouldn't this memset be removed not ? Then res->regul_count would need to
be set to 0.
> }
> @@ -793,8 +793,14 @@ static int hdmi_resources_init(struct hdmi_device *hdev)
> dev_dbg(dev, "HDMI resource init\n");
>
> memset(res, 0, sizeof(*res));
This could be replaced with
res->regul_count = 0;
> - /* get clocks, power */
>
> + res->hdmi = ERR_PTR(-EINVAL);
You could remove this line, as res->sclk_hdmi will be set by clk_get()
right below.
> + res->sclk_hdmi = ERR_PTR(-EINVAL);
> + res->sclk_pixel = ERR_PTR(-EINVAL);
> + res->sclk_hdmiphy = ERR_PTR(-EINVAL);
> + res->hdmiphy = ERR_PTR(-EINVAL);
> +
> + /* get clocks, power */
> res->hdmi = clk_get(dev, "hdmi");
> if (IS_ERR(res->hdmi)) {
> dev_err(dev, "failed to get clock 'hdmi'\n");
>
Regards,
Sylwester
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-02 10:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 5:03 [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sachin Kamat
2013-05-02 5:03 ` [PATCH v2 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Sachin Kamat
2013-05-02 10:23 ` [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sylwester Nawrocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.