From patchwork Wed Jul 30 02:55:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Praznik X-Patchwork-Id: 4645371 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AE4BEC0338 for ; Wed, 30 Jul 2014 02:57:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D479720127 for ; Wed, 30 Jul 2014 02:57:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB86420123 for ; Wed, 30 Jul 2014 02:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754188AbaG3C5Z (ORCPT ); Tue, 29 Jul 2014 22:57:25 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.225]:35527 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751895AbaG3C5Y (ORCPT ); Tue, 29 Jul 2014 22:57:24 -0400 Received: from [24.29.232.96] ([24.29.232.96:50089] helo=localhost.localdomain) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id D5/D7-23320-6DE58D35; Wed, 30 Jul 2014 02:56:22 +0000 From: Frank Praznik To: linux-input@vger.kernel.org Cc: jkosina@suse.cz, Frank Praznik Subject: [PATCH] hid: sony: Default initialize all elements of the LED max_brightness array to 1. Date: Tue, 29 Jul 2014 19:55:48 -0700 Message-Id: <1406688948-33348-1-git-send-email-frank.praznik@oh.rr.com> X-Mailer: git-send-email 1.9.1 X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previously only the first element of the array was initialized to 1 leading to potential incorrect max brightness values for the LEDs on the Dualshock 3 and buzzer controllers. Use a designated initializer to initialize the whole array to the correct value. Signed-off-by: Frank Praznik --- This patch is against jikos/hid.git/for-3.16/upstream-fixes It applies cleanly against for-3.17/sony as well This error never created any noticeable effects since the max value was set to LED_FULL by the led initialization code if it was 0 and it was clamped to 1 in the led setting code if the user tried to set a higher value. This fix is needed in the interest of correctness though. drivers/hid/hid-sony.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 2259eaa..e435223 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1307,7 +1307,7 @@ static int sony_leds_init(struct sony_sc *sc) static const char * const ds4_name_str[] = { "red", "green", "blue", "global" }; __u8 initial_values[MAX_LEDS] = { 0 }; - __u8 max_brightness[MAX_LEDS] = { 1 }; + __u8 max_brightness[MAX_LEDS] = { [0 ... (MAX_LEDS - 1)] = 1 }; __u8 use_hw_blink[MAX_LEDS] = { 0 }; BUG_ON(!(sc->quirks & SONY_LED_SUPPORT));