Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1984816rda; Tue, 24 Oct 2023 08:57:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqlLtoZSe/4HCzaaxpbpEamElCUsM/nSiit3FJdV/LVxxtseh4QinnaWY4Dd3bQM+PFXlz X-Received: by 2002:a17:903:2002:b0:1c6:2f59:8c4d with SMTP id s2-20020a170903200200b001c62f598c4dmr8180223pla.28.1698163041316; Tue, 24 Oct 2023 08:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698163041; cv=none; d=google.com; s=arc-20160816; b=gv+9mDO6PnVedZrH5d6rJFAXjjsQRFXxrHWfqcDLVeqfGM4oDVZYBFmBMoMLRUpKkd 0sCuwEWRGKxALlDANXYpCl5d8e09sKSF/PzB6yNgdqcUNXQbJ2tDAIxVFvIPj7ODVGuZ RKpgsTFbJRf0xw0UDECzGxUuUmGfquR/3oK7xuRnrGFck3Dghk0fSyIw0eltsY+UmzCo 0PBQBQJbc45dkiYPBLfAWXF+4ISdVhUV+rt20lqji0k9RaAxbquNcivzDxrvTQzGDowa V4GkRyl5G2ztG+VFX1+ycSSAW5L+GLPLzfLIELTAd3xF+7kLdSO4CsfbKsDcnY26NwRG nnKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=BNVJRacOEROOJUbOi3+VHcE+dWCyfrMR1wZHRSbWoM0=; fh=4OdLCHkwjzUxZv6zyzd8kHIDDfJGAsy8O3ImS1kzO4Y=; b=bpKrXkQ16hooYHI6Z9nI16HIIdU00quJtrLPd8GmOu3TcZZ2zIHKLMDsQvHQHXVwbe nRWL0trIda4FQ7Tdo5LTvXB0l4rjlEgVGc8lDobzrCrFTeULHDmpEK+LdCzUpV+3H6Iw pYXVG/CNTZRN51oK4q8nt0WRZb6sFWEmjO50eeMKaHGbXycCwZJllHDwwT04bYNDvdSx TElLtMKMwLHniw4czRWJHXFEDm4PpIBuQD5oqYoqVb2epmSEoXc0OSp/4pe1I2oqOZgg tJivkknWJ1KmIQUU+yt6wGWRMyyH5Cdx/7w+4eiCPapxxipKXIIcG2MLm0I4iDl4grT6 u4ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=aK7qefab; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ay1-20020a1709028b8100b001c9c8c4c6d0si8152813plb.26.2023.10.24.08.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=aK7qefab; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 16ADD802B108; Tue, 24 Oct 2023 08:57:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbjJXP5K (ORCPT + 99 others); Tue, 24 Oct 2023 11:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234948AbjJXP5G (ORCPT ); Tue, 24 Oct 2023 11:57:06 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7146F10FC; Tue, 24 Oct 2023 08:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1698163020; bh=BNVJRacOEROOJUbOi3+VHcE+dWCyfrMR1wZHRSbWoM0=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=aK7qefabd1HYLkS2rsJZke9BfVu/vDcyrJRTkRqhCctijuPOl27YWMUK0xzwwgZD5 8Hnf4FIfOL37zBXuKz6VYkKnjsiSMvqtSihMZm414gVikRARfNR/ju5dcQOQNDWpU9 +QutV/PKBIwRHkhBgW/Oyoz9TVZ6JYpBVrap1NJg= Date: Tue, 24 Oct 2023 17:56:47 +0200 (GMT+02:00) From: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh_?= To: Jeff LaBundy Cc: Anshul Dalal , linux-input@vger.kernel.org, devicetree@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Shuah Khan , linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Message-ID: <51c4ab9a-1d45-4665-bb27-0214a9588a1c@t-8ch.de> In-Reply-To: References: <20231017034356.1436677-1-anshulusr@gmail.com> <20231017034356.1436677-2-anshulusr@gmail.com> <00d2fcbc-3fd8-477d-8df1-afec20b458b6@t-8ch.de> Subject: Re: [PATCH v5 2/2] input: joystick: driver for Adafruit Seesaw Gamepad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <51c4ab9a-1d45-4665-bb27-0214a9588a1c@t-8ch.de> X-Spam-Status: No, score=-0.8 required=5.0 tests=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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:57:19 -0700 (PDT) Hi Jeff, Oct 23, 2023 23:24:55 Jeff LaBundy : > On Mon, Oct 23, 2023 at 07:55:52AM +0200, Thomas Wei=C3=9Fschuh=C2=A0 wro= te: > > [...] > >>>> +=C2=A0=C2=A0 err =3D i2c_master_send(client, write_buf, sizeof(write_= buf)); >>>> +=C2=A0=C2=A0 if (err < 0) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return err; >>> >>> You correctly return err (or rather, ret) for negative values, but you = should also >>> check that ret matches the size of the data sent. For 0 <=3D ret < size= of(writebuf), >>> return -EIO. >> >> The driver did this originally. >> I then requested it to be removed as this case >> can never happen. >> i2c_master_send will either return size of(writebuf) or an error. > > Great catch; indeed you are correct. Apologies for having missed this > in the change log; this is good to know in the future. I guess it would make sense to also adapt the function documentation to be more explicit about this invariant. No need to complicate every caller unnecessarily. I can send a patch somewhere next week, but if you want to send one I'll be happy to review it. > That being said, it's a moot point IMO; this driver seems like a good > candidate for regmap. If regmap cannot be made to work here for some > reason, then I'd like to at least see some wrapper functions to avoid > duplicate code and manual assignments to a buffer. Ack. Thomas