Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1775588rwd; Tue, 13 Jun 2023 14:08:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FLbJmTbCKAFRsbBCs+Ttc/BZC6sEN6QlL3+SsZA9uTsJrt4iQJaMEwchneRqRGpOn0GBK X-Received: by 2002:a05:6a00:b4d:b0:663:5624:6fde with SMTP id p13-20020a056a000b4d00b0066356246fdemr15708312pfo.22.1686690534404; Tue, 13 Jun 2023 14:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686690534; cv=none; d=google.com; s=arc-20160816; b=PbUVvNR4fPf/EYqm7JaWsYQvVzvAZR4hpWAOQ4hgOHjR6pDIQEu3H5mbRHP+8TgAeH JoUKE83ES1/hFwlEoHqoPxY1iRyxT0Rpqv3pheF7QJgroQnyTlzGpv+hgUceH25XB60U FvVUVEbNaO0Nux2ViHCbziS66kFvPYDlDcapz+waeryLBL+Jn4RoCmCwjqDFN+nmTwxD icA/+BIkULsGvfkmYWy03x70WUeR1ApxcAV6XOdXX7qW3qy6X8MYMMTzX0j1CagIhRrC l25Ef3OV1br6KtkgBTXmaEWptaPJ/yFjY+QRudk+sQU6b9zxh8+BYWnTF2lnaWXMIpz9 Dtsg== 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=rTBbe2gGMzFAwvKcTj+snfor5ElEPiP/tR0hdfU50nc=; b=PUGH7PukvQ9gUtPuBn0KuddE9+CPcDkGA7LRivyi3Aaq/dzxDX8+dDDDxzZsXGdUKE 6tJfF9AuV4E9AZMq8pm764TyO3i7tA8P7mnnUFHCDjoGVaTPSa7pa/Wd8FptwMZc8p4i umvJBnBLv8L6uEhUUAiAMbiSbxPohgd16um6yn0cJyXmgUMc+mtAMi19L6b2/jzBve8A 6bDxuj7oWteBOF8RqV3n8APhTSMSEw3/CR29weKEZH5/4qb/xqFdOpRpxB3aQO/3Ga+c I8JEHeGo9c3ZAJynLRfEel9RBsK1esO44SyEE/D9lr08xl8JdYYsUg7E+rGHW8WCBDGe 0V2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s2n2S3Pg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a621906000000b00656d1628952si9425111pfz.296.2023.06.13.14.08.41; Tue, 13 Jun 2023 14:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s2n2S3Pg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbjFMUkc (ORCPT + 99 others); Tue, 13 Jun 2023 16:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231713AbjFMUka (ORCPT ); Tue, 13 Jun 2023 16:40:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ACCFB8; Tue, 13 Jun 2023 13:40:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D344617CE; Tue, 13 Jun 2023 20:40:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 209CAC433C8; Tue, 13 Jun 2023 20:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686688827; bh=Z8QA9l2t6x+zzVdOzXUbwg8TddQFuNQ3qjSjveRGaP8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s2n2S3PgON714b2FFpHJWKBiNaKAYAU+06BfFOkqXb1McnAM4rfdaGgbARtf7lP9G pAyyhC1oPxg4aPN1BHxI8Kvg4tYwW1u1yOmV0nn7XKZfgrQX5n84qBJ73tP7Ohw/cn RMkQafwrgkwYUNANIJD/3Rq1ZrDR4rlpzPcc7RI0MBlf2vMI0xG7iG4irseuLQwMoZ vgxC9X2HCJ3e1/7AqZGulZLMS33tBOeH6zFiZRz3Hkgb00tXznq391+FeuX1LfqKso iSYBknpvalI78sNM08nA5quUMz5fo5gtlfZAAvMbeWU3qZpH4V+Pez9nyrjEUWQp6d otWnU+TxFjIcg== Date: Tue, 13 Jun 2023 22:40:24 +0200 From: Andi Shyti To: Johannes Roith Cc: jikos@kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: Re: [PATCH] hid-mcp2200 added driver for MCP2200 GPIOs Message-ID: <20230613204024.zdp45ofohdur462p@intel.intel> References: <20230611144831.41238-1-johannes@gnu-linux.rocks> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230611144831.41238-1-johannes@gnu-linux.rocks> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joannes, [...] > +/* this executes the READ_ALL cmd */ > +static int mcp_cmd_read_all(struct mcp2200 *mcp) > +{ > + struct mcp_read_all *read_all; > + int len, t; > + > + reinit_completion(&mcp->wait_in_report); > + mutex_lock(&mcp->lock); > + > + read_all = kzalloc(sizeof(struct mcp_read_all), GFP_KERNEL); > + if (!read_all) > + return -ENOMEM; where are you unlocking? > + read_all->cmd = READ_ALL; > + len = hid_hw_output_report(mcp->hdev, (u8 *) read_all, > + sizeof(struct mcp_read_all)); > + > + if (len != sizeof(struct mcp_read_all)) > + return -EINVAL; what about read_all? what about the lock? > + > + kfree(read_all); > + mutex_unlock(&mcp->lock); > + t = wait_for_completion_timeout(&mcp->wait_in_report, msecs_to_jiffies(4000)); > + if (!t) > + return -ETIMEDOUT; > + > + /* return status, negative value if wrong response was received */ > + return mcp->status; > +} [...] Andi