From patchwork Wed Jun 15 21:53:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102189 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp71522qgf; Wed, 15 Jun 2016 14:52:04 -0700 (PDT) X-Received: by 10.107.15.31 with SMTP id x31mr2680043ioi.57.1466027524292; Wed, 15 Jun 2016 14:52:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ho7si3204515pac.241.2016.06.15.14.52.03; Wed, 15 Jun 2016 14:52:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753781AbcFOVwB (ORCPT + 30 others); Wed, 15 Jun 2016 17:52:01 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52460 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753293AbcFOVv7 (ORCPT ); Wed, 15 Jun 2016 17:51:59 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MTP9j-1aoEuu2j39-00SKYz; Wed, 15 Jun 2016 23:51:51 +0200 From: Arnd Bergmann To: Greg Kroah-Hartman , Wolfram Sang Cc: Arnd Bergmann , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: ks7010: honor 'const' qualifier Date: Wed, 15 Jun 2016 23:53:11 +0200 Message-Id: <20160615215330.37276-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:0bFdGf87hN65D0TVbjPcVC57DpE3VjZwHcacYrP9AG4pWPOyXZP xtrKSCtZRGa9CzM9bqEVP49wGG9p+u0zL1nQ9A9WiM7ld5TYSBkm0BamlN/Xh6ZiKtW3r5O 8S7uFjG+DHqrmLf7ORuUuzCwTY8BXgFNCepG65DUkRFuCdvqc69HWa83Df8siPp1IrPBjw1 rrXvPc+bKFUaiQHdI3ANA== X-UI-Out-Filterresults: notjunk:1; V01:K0:/vHz1VP8VKQ=:XKU7L5iBShp+/XDe797bEG 4+mSUfeYyYF2DTxDVdisqV34I7+z+pSspBMSAJGA4qwK06QcM3HnwkLAyuWTMrCEHgOG+mpHi +ehqANErTZ4zbOterwSWj6yhMpII0wCGaXytnTP+oGlZSUxLhILaK7VWG0vjoxRhqcR0jBPz5 xdUQ6sDIAyV4SZDGIe0D1fTWLSXp0NWhJnL1NUVazxVr2Cle2isTc4TOA4gYwQz15aUzkz2bH 3zsaWCxIFDHTLVX5CoiXzbVz2DgnFkl0FYgazkHAi6lvuWXD0zJtnx2XP2kI+kHiF84OtIX9N d7jrIOMHRgxw5WHHu7GcYfwSjOyhBMDQ78a9z1mKDixwCgM2QMUUOo6I5UWz1WYhgHxeFdoW1 8s+dxmqpSK+iVi0Xy1puHew6cBmkLC/A2sVJRJt6kjF1LHwi787A2pFVluIi0AywaIzI+MwHR 1w4+Bf4zAw1NJNmvNKtEYHGlahb5KqWVU7iIRhbeaZLcFl2obIWDhg/a3A8Zf1aZFNxjMyrPc iI9PiQbnfg/jwX6k8lb/gXKmpjxtgsy1XJvVUmsBViKWuOhDaOx7BP+gzL5itKAnyUZrXRmS8 e1VoZvXR7hrdJxqr1Iw5PkkFo/0sOLmulySKkOUyGRG6P37uX+cBeKGCjeI6dtQvzirMqZ+vF TTKKU9hlfWaeyc+VALBZE7mVXBvEhhddjp95peGN6JtygWOMfrf2y0JUDscvbQXRX9mE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The recently-added ks7010 driver produces an annoying build warning: drivers/staging/ks7010/ks7010_config.c: In function 'ks_wlan_read_config_file': drivers/staging/ks7010/ks7010_config.c:263:8: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] The problem here is that it assigns the firmware data to a non-const variable, and then goes on to modify it, which is clearly not the intended use case. The only modification is to set the last byte to '\0', and as far as I can tell, this modification is unnecessary, as the parser always compares against the end pointer, rather than relying on zero-termination. This patch therefore removes the modification of the const data and marks all the pointers 'const to avoid the warning. Signed-off-by: Arnd Bergmann --- drivers/staging/ks7010/ks7010_config.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.9.0 diff --git a/drivers/staging/ks7010/ks7010_config.c b/drivers/staging/ks7010/ks7010_config.c index 4b495cbef481..945ff6c7f419 100644 --- a/drivers/staging/ks7010/ks7010_config.c +++ b/drivers/staging/ks7010/ks7010_config.c @@ -16,7 +16,7 @@ static int wep_type; static void analyze_character_wep_key(struct ks_wlan_parameter *param, - int wep_key_index, char *value) + int wep_key_index, const char *value) { int i; unsigned char wep_key[26], key_length; @@ -39,7 +39,7 @@ void analyze_character_wep_key(struct ks_wlan_parameter *param, static void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index, - char *value) + const char *value) { unsigned char wep_end[26], i, j, key_length; @@ -93,7 +93,7 @@ void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index, } static -int rate_set_configuration(struct ks_wlan_private *priv, char *value) +int rate_set_configuration(struct ks_wlan_private *priv, const char *value) { int rc = 0; @@ -204,9 +204,10 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) const struct firmware *fw_entry; struct device *dev = NULL; - char cfg_file[] = CFG_FILE; - char *cur_p, *end_p; - char wk_buff[256], *wk_p; + const char cfg_file[] = CFG_FILE; + const char *cur_p, *end_p; + char wk_buff[256]; + const char *wk_p; /* Initialize Variable */ priv->reg.operation_mode = MODE_INFRASTRUCTURE; /* Infrastructure */ @@ -262,7 +263,6 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) fw_entry->size); cur_p = fw_entry->data; end_p = cur_p + fw_entry->size; - *end_p = '\0'; while (cur_p < end_p) { int i, j, len;