Message ID | 1448372134-26367-3-git-send-email-maarten.lankhorst@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Nov 24, 2015 at 02:35:34PM +0100, Maarten Lankhorst wrote: > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > --- > drivers/gpu/drm/tegra/dsi.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c > index f0a138ef68ce..33ad50487f2e 100644 > --- a/drivers/gpu/drm/tegra/dsi.c > +++ b/drivers/gpu/drm/tegra/dsi.c > @@ -745,14 +745,11 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi) > > static void tegra_dsi_connector_reset(struct drm_connector *connector) > { > - struct tegra_dsi_state *state; > + struct tegra_dsi_state *state = > + kzalloc(sizeof(*state), GFP_KERNEL); I think this could use a check just for safety. It's unlikely to ever happen, but just in case, better allow to fail gracefully than crash. Thierry
Op 07-12-15 om 11:02 schreef Thierry Reding: > On Tue, Nov 24, 2015 at 02:35:34PM +0100, Maarten Lankhorst wrote: >> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> >> --- >> drivers/gpu/drm/tegra/dsi.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c >> index f0a138ef68ce..33ad50487f2e 100644 >> --- a/drivers/gpu/drm/tegra/dsi.c >> +++ b/drivers/gpu/drm/tegra/dsi.c >> @@ -745,14 +745,11 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi) >> >> static void tegra_dsi_connector_reset(struct drm_connector *connector) >> { >> - struct tegra_dsi_state *state; >> + struct tegra_dsi_state *state = >> + kzalloc(sizeof(*state), GFP_KERNEL); > I think this could use a check just for safety. It's unlikely to ever > happen, but just in case, better allow to fail gracefully than crash. I didn't bother because drm_atomic_helper_connector_reset has the same kind of failure. ~Maarten
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index f0a138ef68ce..33ad50487f2e 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -745,14 +745,11 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi) static void tegra_dsi_connector_reset(struct drm_connector *connector) { - struct tegra_dsi_state *state; + struct tegra_dsi_state *state = + kzalloc(sizeof(*state), GFP_KERNEL); kfree(connector->state); - connector->state = NULL; - - state = kzalloc(sizeof(*state), GFP_KERNEL); - if (state) - connector->state = &state->base; + __drm_atomic_helper_connector_reset(connector, &state->base); } static struct drm_connector_state *
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> --- drivers/gpu/drm/tegra/dsi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)