From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB9FCC3A59F for ; Mon, 26 Aug 2019 14:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A70020679 for ; Mon, 26 Aug 2019 14:53:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="oVwPB2bR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730491AbfHZOxN (ORCPT ); Mon, 26 Aug 2019 10:53:13 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:53280 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbfHZOxM (ORCPT ); Mon, 26 Aug 2019 10:53:12 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7QEr8Pc101513; Mon, 26 Aug 2019 09:53:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1566831188; bh=WdleGLWkRq/1jDkaqmOFjUx+wwGB5q5Txqj9k2wYxiw=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=oVwPB2bRqwjC8Omx95WOK5PJJ2JevB88cKFaMXhVn4HKuENHmu3hP2U8r1GRUAcjC iyUKNHE8qnTAnW9ygLfQLo6tW7xjRONSKMjKM35F1/mefjcq5t+sRHdAmlgw2ckXI1 RVsIvc5M5XNmFQ4XuywTCZp2B21iWsY+ZjQeom/M= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7QEr8Zi097286 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Aug 2019 09:53:08 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 26 Aug 2019 09:53:07 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 26 Aug 2019 09:53:07 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7QEr6pu022236; Mon, 26 Aug 2019 09:53:07 -0500 Subject: Re: [PATCH] leds: ti-lmu-common: Fix coccinelle issue in TI LMU To: Jacek Anaszewski , CC: , References: <20190823195523.20950-1-dmurphy@ti.com> <4a1872e8-89a5-4bc4-6aa4-bcadbc48697a@gmail.com> From: Dan Murphy Message-ID: Date: Mon, 26 Aug 2019 09:53:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4a1872e8-89a5-4bc4-6aa4-bcadbc48697a@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Jacek On 8/24/19 10:18 AM, Jacek Anaszewski wrote: > Hi Dan, > > Thank you for the patch. > > On 8/23/19 9:55 PM, Dan Murphy wrote: >> Fix the coccinelle issues found in the TI LMU common code >> >> drivers/leds/leds-ti-lmu-common.c:97:20-29: WARNING: Unsigned expression compared with zero: ramp_down < 0 >> drivers/leds/leds-ti-lmu-common.c:97:5-12: WARNING: Unsigned expression compared with zero: ramp_up < 0 > Wouldn't it make more sense to remove those pointless checks? > Clearly a correct index of an array cannot be negative. > Looking at the code I would make more int -> unsigned int conversions: > > - ramp_table should be unsigned int > - ti_lmu_common_convert_ramp_to_index should return unsigned int > Yeah I was going to just remove the code but when I was writing the original code my intent was to extend the ramp call to allow other TI LMU driver to pass in the device specific ramp table. But since I don't currently have any devices on my plate that require that I can just remove the code as well Dan [...]