From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Guenter Roeck <linux@roeck-us.net>, Rob Clark <robdclark@gmail.com> Cc: Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/msm/disp/dpu1/dpu_encoder: Drop unnecessary NULL checks after container_of Date: Wed, 26 May 2021 04:00:50 +0300 [thread overview] Message-ID: <73c997e5-79dc-f269-f649-d5bc54c2e86c@linaro.org> (raw) In-Reply-To: <20210525112904.1747066-1-linux@roeck-us.net> On 25/05/2021 14:29, Guenter Roeck wrote: > The result of container_of() operations is never NULL unless the embedded > element is the first element of the structure. This is not the case here. > The NULL checks on the result of container_of() are therefore unnecessary > and misleading. Remove them. > > This change was made automatically with the following Coccinelle script. > > @@ > type t; > identifier v; > statement s; > @@ > > <+... > ( > t v = container_of(...); > | > v = container_of(...); > ) > ... > when != v > - if (\( !v \| v == NULL \) ) s > ...+> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > index 8d942052db8a..a573fe211375 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > @@ -1453,11 +1453,6 @@ static void dpu_encoder_off_work(struct work_struct *work) > struct dpu_encoder_virt *dpu_enc = container_of(work, > struct dpu_encoder_virt, delayed_off_work.work); > > - if (!dpu_enc) { > - DPU_ERROR("invalid dpu encoder\n"); > - return; > - } > - > dpu_encoder_resource_control(&dpu_enc->base, > DPU_ENC_RC_EVENT_ENTER_IDLE); > > @@ -1797,11 +1792,6 @@ static void dpu_encoder_vsync_event_work_handler(struct kthread_work *work) > struct dpu_encoder_virt, vsync_event_work); > ktime_t wakeup_time; > > - if (!dpu_enc) { > - DPU_ERROR("invalid dpu encoder\n"); > - return; > - } > - > if (dpu_encoder_vsync_time(&dpu_enc->base, &wakeup_time)) > return; > > -- With best wishes Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Guenter Roeck <linux@roeck-us.net>, Rob Clark <robdclark@gmail.com> Cc: Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: Re: [PATCH] drm/msm/disp/dpu1/dpu_encoder: Drop unnecessary NULL checks after container_of Date: Wed, 26 May 2021 04:00:50 +0300 [thread overview] Message-ID: <73c997e5-79dc-f269-f649-d5bc54c2e86c@linaro.org> (raw) In-Reply-To: <20210525112904.1747066-1-linux@roeck-us.net> On 25/05/2021 14:29, Guenter Roeck wrote: > The result of container_of() operations is never NULL unless the embedded > element is the first element of the structure. This is not the case here. > The NULL checks on the result of container_of() are therefore unnecessary > and misleading. Remove them. > > This change was made automatically with the following Coccinelle script. > > @@ > type t; > identifier v; > statement s; > @@ > > <+... > ( > t v = container_of(...); > | > v = container_of(...); > ) > ... > when != v > - if (\( !v \| v == NULL \) ) s > ...+> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > index 8d942052db8a..a573fe211375 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > @@ -1453,11 +1453,6 @@ static void dpu_encoder_off_work(struct work_struct *work) > struct dpu_encoder_virt *dpu_enc = container_of(work, > struct dpu_encoder_virt, delayed_off_work.work); > > - if (!dpu_enc) { > - DPU_ERROR("invalid dpu encoder\n"); > - return; > - } > - > dpu_encoder_resource_control(&dpu_enc->base, > DPU_ENC_RC_EVENT_ENTER_IDLE); > > @@ -1797,11 +1792,6 @@ static void dpu_encoder_vsync_event_work_handler(struct kthread_work *work) > struct dpu_encoder_virt, vsync_event_work); > ktime_t wakeup_time; > > - if (!dpu_enc) { > - DPU_ERROR("invalid dpu encoder\n"); > - return; > - } > - > if (dpu_encoder_vsync_time(&dpu_enc->base, &wakeup_time)) > return; > > -- With best wishes Dmitry
next prev parent reply other threads:[~2021-05-26 1:00 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-25 11:29 [PATCH] drm/msm/disp/dpu1/dpu_encoder: Drop unnecessary NULL checks after container_of Guenter Roeck 2021-05-25 11:29 ` Guenter Roeck 2021-05-25 16:18 ` Bjorn Andersson 2021-05-25 16:18 ` Bjorn Andersson 2021-05-26 1:00 ` Dmitry Baryshkov [this message] 2021-05-26 1:00 ` Dmitry Baryshkov
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=73c997e5-79dc-f269-f649-d5bc54c2e86c@linaro.org \ --to=dmitry.baryshkov@linaro.org \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@roeck-us.net \ --cc=robdclark@gmail.com \ --cc=sean@poorly.run \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.