aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-08-11 09:49:07 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-08-16 05:52:42 -0400
commit863f9cde269f533f363ab2d0e241f503e1c87552 (patch)
tree2d612c2cb920c832fab7d6ffa5f06c94f3d6b4af
parent37ea27b97b6a5ef073e71169dbc95d89f4daa288 (diff)
drm: omapdrm: hdmi: Don't allocate PHY features dynamically
There's no need to allocate memory dynamically to duplicate the contents of a const structure, only to store the memory pointer in a const pointer field. Just use the original structures directly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_phy.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index 95770c3203a1..a156292b1820 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -182,39 +182,15 @@ static const struct hdmi_phy_features omap54xx_phy_feats = {
182 .max_phy = 186000000, 182 .max_phy = 186000000,
183}; 183};
184 184
185static int hdmi_phy_init_features(struct platform_device *pdev,
186 struct hdmi_phy_data *phy,
187 unsigned int version)
188{
189 struct hdmi_phy_features *dst;
190 const struct hdmi_phy_features *src;
191
192 dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
193 if (!dst) {
194 dev_err(&pdev->dev, "Failed to allocate HDMI PHY Features\n");
195 return -ENOMEM;
196 }
197
198 if (version == 4)
199 src = &omap44xx_phy_feats;
200 else
201 src = &omap54xx_phy_feats;
202
203 memcpy(dst, src, sizeof(*dst));
204 phy->features = dst;
205
206 return 0;
207}
208
209int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy, 185int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,
210 unsigned int version) 186 unsigned int version)
211{ 187{
212 int r;
213 struct resource *res; 188 struct resource *res;
214 189
215 r = hdmi_phy_init_features(pdev, phy, version); 190 if (version == 4)
216 if (r) 191 phy->features = &omap44xx_phy_feats;
217 return r; 192 else
193 phy->features = &omap54xx_phy_feats;
218 194
219 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); 195 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
220 phy->base = devm_ioremap_resource(&pdev->dev, res); 196 phy->base = devm_ioremap_resource(&pdev->dev, res);