Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp525393rdb; Thu, 19 Oct 2023 10:57:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETQyCUwFyL2KUraZ5L7Oc1exuhyYb5jkXzrZarNMjFz/5Kr4NoLm8Qvr9XQMVYtke4zZsE X-Received: by 2002:a05:6870:b520:b0:1e9:e605:279b with SMTP id v32-20020a056870b52000b001e9e605279bmr3717014oap.19.1697738236403; Thu, 19 Oct 2023 10:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697738236; cv=none; d=google.com; s=arc-20160816; b=L4QTahbT6lV0a/3+4FaW8IrLVPXth4eJcX+PQpv0nPCBkn+iCuwVp0g32wWalePC34 HGq+A86vXEhCm5qQDU2zaogWBivAzsjZzfKuFI2jMhI9TbmfEmPDGDK8OAXGts+Zrm4v N8AB5qJnoBM40yuDL1+PM9U0NSXKo1UyszR+zLsHKr24yjzZM3//1umRsk8Vq2zMgQgJ xfXEWG+JGcRXw6ACelzC8NzL41W2kpiIatK+5aAWmzacn5ZyURWRRuiHdi0/V36wNaxj rKghj7+Xm5pOBkSdx70O6AMsAZ3i/OxajGFNrmwp8vOlpNu4rdmBkFRBzSeLavuKqf+a Ob2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6PKliVkgIEIvwTRHn4s/7jxITECEMYBJQPsi/PUznYE=; fh=6iNpQlG9uk2IhCLo7Sv+1l1pzIRu4iul/NtxIWGS1F0=; b=DGC8bnyyqo9WmRZ+gwTDX4oBELqcf8ttaumTQOZKAtrleyh/12wvvTxzmxHEFTRxjp zVeG4TSEn0psb6uGYN1TYjL5VFwUhDBqHWRgo2+8iEJOrH2Fo57TdkGbhzfn9EeCRXze HH8i935R6rkWldRL6UAJKSJ5QEY7LXmuTXiRHnuvOEJknTxkrwanWEYJ9qP2P+7JhVfh /oc2Djb6J9Gtewkms3AuryKVXmJmJIGN5PxKQ/gQdDqWKH6jyl/vAexW/WtPRIj7HkoK X8V3PxFZ6f2DmQzECeiuXsbyhVcb7Fd4YRFCY/+LoEWWUrQJZsHfGrgmxtVfHnGHuT0n h74w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xdjCSwh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id az1-20020a056a02004100b0059cc8d682dfsi74280pgb.814.2023.10.19.10.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 10:57:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xdjCSwh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1E9C8835FD0D; Thu, 19 Oct 2023 10:57:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345405AbjJSR5J (ORCPT + 99 others); Thu, 19 Oct 2023 13:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbjJSR5I (ORCPT ); Thu, 19 Oct 2023 13:57:08 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD2D4E8 for ; Thu, 19 Oct 2023 10:57:06 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2BB8C433C8; Thu, 19 Oct 2023 17:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697738226; bh=8mcVIkh+ilUfV+/qwx1svrvpt+dMNpngwLshc/nC9SU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xdjCSwh/wyoz/GXl8HyjGJpFGWmGj53WFlchZPoHrYGth53m8d94v0VxMg0WsttU/ Z53FtVFfS2lEt4o3Q4kYcrCN2ahp2l81zsfORezV+5CzQougLcoJB8QGIHYwqb8anw cAWviGhTinR7jKDUQ9QMXDPqgUa2o3ibZ+MDQDGk= Date: Thu, 19 Oct 2023 19:57:02 +0200 From: Greg Kroah-Hartman To: Eliza Balas Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Derek Kiernan , Dragan Cvetic , Arnd Bergmann Subject: Re: [PATCH v3 2/2] drivers: misc: adi-axi-tdd: Add TDD engine Message-ID: <2023101917-cork-numeric-dab8@gregkh> References: <20231019125646.14236-1-eliza.balas@analog.com> <20231019125646.14236-3-eliza.balas@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231019125646.14236-3-eliza.balas@analog.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 10:57:14 -0700 (PDT) On Thu, Oct 19, 2023 at 03:56:46PM +0300, Eliza Balas wrote: > +config ADI_AXI_TDD > + tristate "Analog Devices TDD Engine support" > + depends on HAS_IOMEM > + select REGMAP_MMIO > + help > + The ADI AXI TDD core is the reworked and generic TDD engine which > + was developed for general use in Analog Devices HDL projects. Unlike > + the previous TDD engine, this core can only be used standalone mode, > + and is not embedded into other devices. What does "previous" mean here? That's not relevant for a kernel help text, is it? Also, what is the module name? Why would someone enable this? What userspace tools use it? > + > config DUMMY_IRQ > tristate "Dummy IRQ handler" > help Why put your entry in this specific location in the file? > +static int adi_axi_tdd_parse_ms(struct adi_axi_tdd_state *st, > + const char *buf, > + u64 *res) > +{ > + u64 clk_rate = READ_ONCE(st->clk.rate); > + char *orig_str, *modf_str, *int_part, frac_part[7]; > + long ival, frac; > + int ret; > + > + orig_str = kstrdup(buf, GFP_KERNEL); > + int_part = strsep(&orig_str, "."); Why are we parsing floating point in the kernel? Please just keep the api simple so that we don't have to try to do any type of parsing other than turning a single text number into a value. > + ret = kstrtol(int_part, 10, &ival); > + if (ret || ival < 0) > + return -EINVAL; You leaked memory :( Use the new logic in completion.h to make this simpler? > + modf_str = strsep(&orig_str, "."); > + if (modf_str) { > + snprintf(frac_part, 7, "%s00000", modf_str); > + ret = kstrtol(frac_part, 10, &frac); > + if (ret) > + return -EINVAL; You leaked memory :( > + } else { > + frac = 0; > + } > + > + *res = DIV_ROUND_CLOSEST_ULL((u64)ival * clk_rate, 1000) > + + DIV_ROUND_CLOSEST_ULL((u64)frac * clk_rate, 1000000000); Why isn't userspace doing this calculation? I stopped reviewing here, sorry. greg k-h