Loading drivers/gpu/drm/msm/dp/dp_debug.c +16 −1 Original line number Original line Diff line number Diff line /* /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -49,6 +49,7 @@ struct dp_debug_private { struct device *dev; struct device *dev; struct work_struct sim_work; struct work_struct sim_work; struct dp_debug dp_debug; struct dp_debug dp_debug; struct mutex lock; }; }; static int dp_debug_get_edid_buf(struct dp_debug_private *debug) static int dp_debug_get_edid_buf(struct dp_debug_private *debug) Loading Loading @@ -98,6 +99,8 @@ static ssize_t dp_debug_write_edid(struct file *file, if (!debug) if (!debug) return -ENODEV; return -ENODEV; mutex_lock(&debug->lock); if (*ppos) if (*ppos) goto bail; goto bail; Loading Loading @@ -148,6 +151,7 @@ static ssize_t dp_debug_write_edid(struct file *file, if (!debug->dp_debug.sim_mode) if (!debug->dp_debug.sim_mode) debug->panel->set_edid(debug->panel, edid); debug->panel->set_edid(debug->panel, edid); mutex_unlock(&debug->lock); return rc; return rc; } } Loading @@ -166,6 +170,8 @@ static ssize_t dp_debug_write_dpcd(struct file *file, if (!debug) if (!debug) return -ENODEV; return -ENODEV; mutex_lock(&debug->lock); if (*ppos) if (*ppos) goto bail; goto bail; Loading Loading @@ -230,6 +236,7 @@ static ssize_t dp_debug_write_dpcd(struct file *file, else else debug->panel->set_dpcd(debug->panel, dpcd); debug->panel->set_dpcd(debug->panel, dpcd); mutex_unlock(&debug->lock); return rc; return rc; } } Loading Loading @@ -873,6 +880,8 @@ static ssize_t dp_debug_write_sim(struct file *file, if (*ppos) if (*ppos) return 0; return 0; mutex_lock(&debug->lock); /* Leave room for termination char */ /* Leave room for termination char */ len = min_t(size_t, count, SZ_8 - 1); len = min_t(size_t, count, SZ_8 - 1); if (copy_from_user(buf, user_buff, len)) if (copy_from_user(buf, user_buff, len)) Loading Loading @@ -906,9 +915,11 @@ static ssize_t dp_debug_write_sim(struct file *file, debug->aux->set_sim_mode(debug->aux, debug->dp_debug.sim_mode, debug->aux->set_sim_mode(debug->aux, debug->dp_debug.sim_mode, debug->edid, debug->dpcd); debug->edid, debug->dpcd); end: end: mutex_unlock(&debug->lock); return len; return len; error: error: devm_kfree(debug->dev, debug->edid); devm_kfree(debug->dev, debug->edid); mutex_unlock(&debug->lock); return len; return len; } } Loading Loading @@ -1272,6 +1283,8 @@ struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, dp_debug->hdisplay = 0; dp_debug->hdisplay = 0; dp_debug->vrefresh = 0; dp_debug->vrefresh = 0; mutex_init(&debug->lock); rc = dp_debug_init(dp_debug); rc = dp_debug_init(dp_debug); if (rc) { if (rc) { devm_kfree(dev, debug); devm_kfree(dev, debug); Loading Loading @@ -1308,6 +1321,8 @@ void dp_debug_put(struct dp_debug *dp_debug) dp_debug_deinit(dp_debug); dp_debug_deinit(dp_debug); mutex_destroy(&debug->lock); if (debug->edid) if (debug->edid) devm_kfree(debug->dev, debug->edid); devm_kfree(debug->dev, debug->edid); Loading Loading
drivers/gpu/drm/msm/dp/dp_debug.c +16 −1 Original line number Original line Diff line number Diff line /* /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -49,6 +49,7 @@ struct dp_debug_private { struct device *dev; struct device *dev; struct work_struct sim_work; struct work_struct sim_work; struct dp_debug dp_debug; struct dp_debug dp_debug; struct mutex lock; }; }; static int dp_debug_get_edid_buf(struct dp_debug_private *debug) static int dp_debug_get_edid_buf(struct dp_debug_private *debug) Loading Loading @@ -98,6 +99,8 @@ static ssize_t dp_debug_write_edid(struct file *file, if (!debug) if (!debug) return -ENODEV; return -ENODEV; mutex_lock(&debug->lock); if (*ppos) if (*ppos) goto bail; goto bail; Loading Loading @@ -148,6 +151,7 @@ static ssize_t dp_debug_write_edid(struct file *file, if (!debug->dp_debug.sim_mode) if (!debug->dp_debug.sim_mode) debug->panel->set_edid(debug->panel, edid); debug->panel->set_edid(debug->panel, edid); mutex_unlock(&debug->lock); return rc; return rc; } } Loading @@ -166,6 +170,8 @@ static ssize_t dp_debug_write_dpcd(struct file *file, if (!debug) if (!debug) return -ENODEV; return -ENODEV; mutex_lock(&debug->lock); if (*ppos) if (*ppos) goto bail; goto bail; Loading Loading @@ -230,6 +236,7 @@ static ssize_t dp_debug_write_dpcd(struct file *file, else else debug->panel->set_dpcd(debug->panel, dpcd); debug->panel->set_dpcd(debug->panel, dpcd); mutex_unlock(&debug->lock); return rc; return rc; } } Loading Loading @@ -873,6 +880,8 @@ static ssize_t dp_debug_write_sim(struct file *file, if (*ppos) if (*ppos) return 0; return 0; mutex_lock(&debug->lock); /* Leave room for termination char */ /* Leave room for termination char */ len = min_t(size_t, count, SZ_8 - 1); len = min_t(size_t, count, SZ_8 - 1); if (copy_from_user(buf, user_buff, len)) if (copy_from_user(buf, user_buff, len)) Loading Loading @@ -906,9 +915,11 @@ static ssize_t dp_debug_write_sim(struct file *file, debug->aux->set_sim_mode(debug->aux, debug->dp_debug.sim_mode, debug->aux->set_sim_mode(debug->aux, debug->dp_debug.sim_mode, debug->edid, debug->dpcd); debug->edid, debug->dpcd); end: end: mutex_unlock(&debug->lock); return len; return len; error: error: devm_kfree(debug->dev, debug->edid); devm_kfree(debug->dev, debug->edid); mutex_unlock(&debug->lock); return len; return len; } } Loading Loading @@ -1272,6 +1283,8 @@ struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, dp_debug->hdisplay = 0; dp_debug->hdisplay = 0; dp_debug->vrefresh = 0; dp_debug->vrefresh = 0; mutex_init(&debug->lock); rc = dp_debug_init(dp_debug); rc = dp_debug_init(dp_debug); if (rc) { if (rc) { devm_kfree(dev, debug); devm_kfree(dev, debug); Loading Loading @@ -1308,6 +1321,8 @@ void dp_debug_put(struct dp_debug *dp_debug) dp_debug_deinit(dp_debug); dp_debug_deinit(dp_debug); mutex_destroy(&debug->lock); if (debug->edid) if (debug->edid) devm_kfree(debug->dev, debug->edid); devm_kfree(debug->dev, debug->edid); Loading