[PATCH 1/1]drm/gma500: mdfld: Remove unncessary code

Patrik Jakobsson patrik.r.jakobsson at gmail.com
Wed Jun 24 01:33:25 PDT 2015


On Wed, Jun 24, 2015 at 9:10 AM, Maninder Singh <maninder1.s at samsung.com> wrote:
> sender is dereferrenced before NULL check
> struct drm_device *dev = sender->dev;
>
> and due to this we get warning during static analysis:
> warn: variable dereferenced before check 'sender'
>
> __read_panel_data Function is called by mdfld_dsi_read_mcs
> and there is a same check, Thus removing the check from
> __read_panel_data.
>
> Signed-off-by: Maninder Singh <maninder1.s at samsung.com>
> Reviewed-by: Vaneet Narang <v.narang at samsung.com>
> ---
>  drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |    5 -----
>  1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> index 6b43ae3..d29b881 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> @@ -525,11 +525,6 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
>         u32 gen_data_reg;
>         int retry = MDFLD_DSI_READ_MAX_COUNT;
>
> -       if (!sender || !data_out || !len_out) {
> -               DRM_ERROR("Invalid parameters\n");
> -               return -EINVAL;
> -       }
> -

I would prefer to have these kind of checks where it actually matters
(ie. in __read_panel_data()). The saner thing would be to move the
dereference until after the check and remove the duplicated check from
mdfld_dsi_read_mcs(). That would prevent any further need for adding
additional checks whenever calling __read_panel_data().

Cheers
Patrik

>         /**
>          * do reading.
>          * 0) send out generic read request
> --
> 1.7.1
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list