From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761733AbcINHpU (ORCPT ); Wed, 14 Sep 2016 03:45:20 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:60480 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761706AbcINHpP (ORCPT ); Wed, 14 Sep 2016 03:45:15 -0400 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 25/51] extcon: Remove the state_store() to prevent the wrong access Date: Wed, 14 Sep 2016 13:14:06 +0530 Message-ID: <1473839072-5673-26-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1473839072-5673-1-git-send-email-kishon@ti.com> References: <1473839072-5673-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chanwoo Choi This patch removes the state_store() which change the state of external connectors with bit masking on user-space. It is wrong access to modify the change the state of external connectors. Signed-off-by: Chanwoo Choi Signed-off-by: Kishon Vijay Abraham I --- drivers/extcon/extcon.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 319659c..ad5e454 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -174,26 +174,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr, return count; } - -static ssize_t state_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - u32 state; - ssize_t ret = 0; - struct extcon_dev *edev = dev_get_drvdata(dev); - - ret = sscanf(buf, "0x%x", &state); - if (ret == 0) - ret = -EINVAL; - else - ret = extcon_set_state(edev, state); - - if (ret < 0) - return ret; - - return count; -} -static DEVICE_ATTR_RW(state); +static DEVICE_ATTR_RO(state); static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) -- 1.7.9.5