Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1999316lqb; Mon, 27 May 2024 04:55:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHM1MkV+mLNApNfUz84OGUqw5Kv6jhJvv7ZTOBxXX5grrEYPRq8QeNYXBq+hDiNlnOSAYL9dYp3eA3qNlN2j3UzJInRKLZphC+jMp86w== X-Google-Smtp-Source: AGHT+IHfxY42Iu5qx5UZUb0H/o6mQ8ORrxGKUuHKQNdyLh/OLbZ0a46qGOPs0LlCzP+ZOjS8UGr8 X-Received: by 2002:a05:6a00:4206:b0:6f3:ebc4:4406 with SMTP id d2e1a72fcca58-6f8f2c57e0amr9766763b3a.7.1716810923776; Mon, 27 May 2024 04:55:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716810923; cv=pass; d=google.com; s=arc-20160816; b=dg4mfXqARRSGkCRD1qrtup34FCSJy9GiP3FHBRCy5UcNDHamu1ptok238jeaDDQg6H rcLIwzKJHXecaz2wzzp4ASBzpxK02yuHIvxFLeh1F8/uY9qw0i7BoLi+H1mbvefGHIw7 x4TVrNI4xNBZ5S/YNMKNTeQMH3Ku7HYln6jgWq6qtrdNPK65fuhD/uH/unNRE+oT/lbw haiReHCa2xaaPH8oYuSLG3hK0Axm7uoozZpBXicPPomM7szHdleSuWZwWdM5ViD3SwSV 2Z//R1GY/32rmzF1ezIsL9K7/MobWiLyNeJqpcHtDFhHlCnwW2I6vUL5HF3NZNGHPuod ST4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=3u9+Rm0QSuOetnYvXN2dLgl+DFtTpVtk+t4PrA9bwrY=; fh=vNW54pFSrQ7aWuJQdA7cWwiPRXTWIm6lxjKOoR8OF6o=; b=Twy8Q7V7NpV0FRREOvBieM3FQKQAlu/Z5+4BV+qQ4BAkMCW4wlVmw7egEXYhyZXz3u rVs+XVdMtW6248b/qcuAEUqXu2ja5T3njeTiM5kNUHT7i6RIWZqVZoW4aQ5YnQzIH7+C sLu/W1O8WIunNqHFQqcV3ebPfb/Vaa7Yxy6kIUVuErYe3QN0c7OIjZQTGq0fnpkmyHQo Qg0+aIN7DS4PviZ4cNp88M6XF4oO4GQILmXR/EXx+OXQgfB7jSufWuRhH1EyghLuHVl+ qNKbLxQToI9V8w4jw4gxLhXfbryPEnEepcTIHMu/uF+JXSNbbrcqlnMpeZcAWkdOiHEs e96g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=frMP3jSg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-190519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fcfd80a5si6148902b3a.186.2024.05.27.04.55.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 04:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=frMP3jSg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-190519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C22882851F2 for ; Mon, 27 May 2024 11:54:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1EFF15E5B1; Mon, 27 May 2024 11:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="frMP3jSg" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA07813AA31; Mon, 27 May 2024 11:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716810880; cv=none; b=RzX+N5Dh5Ep9WTAys1pKX4VwwBv9j+m7Hpip1mOBN7GCti6oxqKqwcA6uHNsRHPHtLukR3O+If8LvyXZSJRgKp3FUB1MbP96L21TDCvDWNy9MtxdRnN/6h4Q4sR93JeoV4PpW1X3G5nZvoIluEfNqrK6MJHo5QWJtHWgjDfKSEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716810880; c=relaxed/simple; bh=Ep8t7vPeAwXRzCTeTUUWkx1TqvppgijvQkJ80jbST/g=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Z0xm30ZVCUojCbxLh/JO+KkBbRxXykrGEfUJWUuTIOdbCQWigqPMRK1Hz44ieFgiw6OKMD3MXFzdN5Qf7+AzdsZNrie9+p/ny/Yt5KYn+u98Ou0Z56QMJxX6CzDkyIKzpG6lUuX9GezahifTPKm235r+HKyLSUFp7nZKUxAkbJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=frMP3jSg; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6f850ff30c0so3305593b3a.0; Mon, 27 May 2024 04:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716810878; x=1717415678; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3u9+Rm0QSuOetnYvXN2dLgl+DFtTpVtk+t4PrA9bwrY=; b=frMP3jSgE2E7gzEuQBlzhjMGCXHfginjVlZHX7AWYgYZGVkR6exzLNQPa6fEjgLZKt 0o5yL7ls0uwd+6XAnTbz/r3F97cqcZkVGATJAe90tuAR6MtBGJtm/3l8geHkAnaW4FDm LvFzsbTPqfra1rWuJthYSwdOW8UYhn0iJ29vh8CYFJLhTLwlu6bS5g1r4Uo5JdvyVgIn Nm3H8p1VjTADjv+pO9XPUEcUGwMCVcmP9l1Y7KcSQIqORuOdAzCbEuD1GOguKcT7o+9U 3dK/1jKs//jpOqZmhqnD5+EAnWRJnrNUCm8ku3/8gtgygSQjpGtsSU+GUfKosipr+c7b RFkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716810878; x=1717415678; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3u9+Rm0QSuOetnYvXN2dLgl+DFtTpVtk+t4PrA9bwrY=; b=oYcZq1ygbrXcH6/GAy6EwaruA6EfNdy77WsX6whHzCDOUIo9HZZlDXUUhyv3aiQQh5 PgWMTQVGmqm8uCkGSLYDJ/g40wHlMsYf2u4jrpNmb0WY9j/LxrDnYJ0MJULzlh/f+GKD fevoMQFgioqYNnOduLEBTMkocyalRVI7PtW5I5Nk0b8Q+/Z+x7kSDp+3eGrIahOewKmE QtzZ1bE4p/E5J+x7NBv2UCmjItGhNJ43aMW/fqUtQwdYcNTEGcQdlD2hrWA6jByfkGaG LmvpAdYCdxRKJxd/ZKuosYGDMEvebnJlOpSmvJj2DOz9RjqWHHo6sH4iUKrJWFX3tYw7 POZw== X-Forwarded-Encrypted: i=1; AJvYcCVNDF3bNMyf/PmZi7kXGBE1crxcF4OhRYy7rsiYnKisdGr/i0djEG40l9TwvLLz+wJx1LzNS6JZlV/o9anwcvezcoflCXsvPC/baA== X-Gm-Message-State: AOJu0YzEghssDRigL92/m+kA/LXAsF/soGq6yGIo/nhEsR16hdN6p326 r9+6Ci3ifwluYc/xW4v+/x5QdR/SiEEYR+vG5inGvgrASQGqoXuAySXx/A== X-Received: by 2002:a05:6a00:2911:b0:6f3:854c:dee0 with SMTP id d2e1a72fcca58-6f8f3e843ecmr10371888b3a.21.1716810877830; Mon, 27 May 2024 04:54:37 -0700 (PDT) Received: from rigel.home.arpa (60-241-107-82.static.tpgi.com.au. [60.241.107.82]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fcbea8a9sm4749256b3a.139.2024.05.27.04.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 04:54:37 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org Cc: Kent Gibson Subject: [PATCH 0/3] gpiolib: cdev: tidy up kfifo handling Date: Mon, 27 May 2024 19:54:16 +0800 Message-Id: <20240527115419.92606-1-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series is a follow up to my recent kfifo initialisation fix[1]. Patch 1 adds calling INIT_KFIFO() on the event kfifo in order to induce an oops if the kfifo is accessed prior to being allocated. Not calling INIT_KFIFO() could be considered an abuse of the kfifo API. I don't recall, but it is possible that it was not being called as we also make use of kfifo_initialized(), and the assumption was that it would return true after the INIT_KFIFO() call. In fact it only returns true once the kfifo has been allocated. Patch 2 adds a helper to perform the allocation of the kfifo to reduce code duplication. Patch 3 tidies up the handling of kfifo_out() errors, making them visible where they may currently be obscured. These errors are not expected to ever happen, so this should not produce any visible difference, but if they do occur it will now be more obvious. Cheers, Kent. [1] https://lore.kernel.org/linux-gpio/20240510065342.36191-1-warthog618@gmail.com/ Kent Gibson (3): gpiolib: cdev: Add INIT_KFIFO() for linereq events gpiolib: cdev: Refactor allocation of linereq events kfifo gpiolib: cdev: Cleanup kfifo_out() error handling drivers/gpio/gpiolib-cdev.c | 74 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 39 deletions(-) -- 2.39.2