On Wed, Jun 24, 2015 at 1:56 PM, Maninder Singh <maninder1.s@xxxxxxxxxxx> wrote: > sender is dereferrenced before NULL check > struct drm_device *dev = sender->dev; > > and due to there is 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 > mdfld_dsi_read_mcs and initializing dev struct after NULL check > of sender. > > Suggested-by: Patrick Jakobsson <patrick.r.jakobsson@xxxxxxxxx> The spelling of my name is slightly unorthodox :) should be <patrik.r.jakobsson@xxxxxxxxx> > Signed-off-by: Maninder Singh <maninder1.s@xxxxxxxxxxx> > Reviewed-by: Vaneet Narang <v.narang@xxxxxxxxxxx> > --- > v1: removes check from __read_panel_data > v2: remove check from mdfld_dsi_read_mcs instead of __read_panel_data > > drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 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..959aaeb 100644 > --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c > +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c > @@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, > u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs) > { > unsigned long flags; > - struct drm_device *dev = sender->dev; > + struct drm_device *dev; > int i; > u32 gen_data_reg; > int retry = MDFLD_DSI_READ_MAX_COUNT; > @@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, > return -EINVAL; > } > > + dev = sender->dev; > + > /** > * do reading. > * 0) send out generic read request > @@ -576,11 +578,6 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, > int mdfld_dsi_read_mcs(struct mdfld_dsi_pkg_sender *sender, u8 cmd, > u32 *data, u16 len, bool hs) > { > - if (!sender || !data || !len) { > - DRM_ERROR("Invalid parameters\n"); > - return -EINVAL; > - } > - > return __read_panel_data(sender, MIPI_DSI_DCS_READ, &cmd, 1, > data, len, hs); > } > -- > 1.7.9.5 > Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx> _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel