Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1081663rdb; Fri, 16 Feb 2024 05:02:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUlMnW58iC4Ml4NLKeZYzlABkesPwYgiWWtXhLEyVGLyKWdaQ9hxAv59UViFsysPkcVi8Q5t86BW7jainT7MLewjnCa64KkAvSG5YENPw== X-Google-Smtp-Source: AGHT+IFNFdWEQI4MtoZYjN54ekZpOf+RcArBAACr5BGXJtKLnyat+rtqxNvvlrnng+JyinGqp82T X-Received: by 2002:a05:6a00:26eb:b0:6e0:f815:8835 with SMTP id p43-20020a056a0026eb00b006e0f8158835mr3854619pfw.32.1708088565851; Fri, 16 Feb 2024 05:02:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708088565; cv=pass; d=google.com; s=arc-20160816; b=kYiTYmrWrdqDY9OmhoMiVD0sA8QeeUzTZQk5Uq9TQJ8oi53GaRgn3L6uJLaDHoFJZ9 y+R1aVtJyV5F9NP5qSm4cBOpKl8jmcZDJG640ROOtjIUrW0fn+666dK0/CyBJ5CmqbG0 VWuy0tDlX6Wa/NvibQAj/HoHW116Fkm/U4wZBI5JElNelLpqx3hWR9Z1sEE7ZN9Dg1wy 6M2noyFaR1TZwXmAhL5WyYIexrVEpbHhtejp5e01G2Ktr2AQMtZuZ3jOitkVb/exnSVO JmcNaS/cdA6eKIs8IbcZDAhh2lUHbw14D+c3nJneAa0lraJQ6RGJ8gvNXjDxZ6qaiKAx J0Mw== 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=zGXKsXy51gCJICrOkl6rSU4KrFKit0QjMm02SUIQI4M=; fh=dRQP0hx5XHjIU2/wzQWJ/Mhz5BphUU9mbrcUM82OYFk=; b=YPpmeO4C0qNU4kjuHtJ8tdmxgcbPcCMDEBjMalty/LPfgBhmUYw1QpRMO04GIwp+3m PKI5HqHL1gNhkSoZ3VSAMfqCe/yd2thPsNthZwXeIcDb6OPND8atGARLyI7Qx2hYhOVk 7nqiMPe192Twd6JZGI/T4PcRZv+hg04TPbJ9UEwAIx6j5tPLI5WfeRt279lRoTjOoLvV 1eQI6Uunl71SB73ImimXaRfSEV71r55syJDePMwP3Fnu9AXHW8dTVqDJYT2/ovwwbOSZ byRl1hJDM+9O2MwXIhHYzHK8DqPgeQEZaB494Bs76S35O8lGkLz8CiQIX4TayWRPRXW2 /U5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gMybALGW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68603-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a20-20020a637f14000000b005dbedc825b5si3012858pgd.521.2024.02.16.05.02.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 05:02:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gMybALGW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68603-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 977B1B23610 for ; Fri, 16 Feb 2024 13:00:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE8BD1292DE; Fri, 16 Feb 2024 13:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gMybALGW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23A5B128825; Fri, 16 Feb 2024 13:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708088406; cv=none; b=nti9srGrutdir8DnS78cH+Fm3aYTAe/RxJx0E2iLDh/n4Q9zt3IMBuvUqalm0EslaqI0HVgTK4pSdv1qoHwZXkR2uGSPFzx4YRW9hEug5XufP/Dj9IAQos7sk5t7s2UZnLqFliUv+Tp7/57rE4hQeela1dunOcBg7K+GCIwFhRg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708088406; c=relaxed/simple; bh=Fua+75fYl25KxH7zo3jRCWk4YuWrcZJH5ZiE41IuRQo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=H5otpB7D1QWo65S0DPyofP0h9cnn3Vs45gHHP/ACHG5e3NvjZQ+hUs9zMtyggWIY+o6GjNaOGZlBIfQGLM1yYqx/MnHRcmkrkMtOUifFI++1xBQJV4GtRXbnWtvX8E176CeEUmUou4sMvQG+QcRsqTVgf3bqJ7ZKv9FMx650Af8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gMybALGW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA108C433F1; Fri, 16 Feb 2024 13:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708088405; bh=Fua+75fYl25KxH7zo3jRCWk4YuWrcZJH5ZiE41IuRQo=; h=From:To:Cc:Subject:Date:From; b=gMybALGWtGK83QV3RuisQujmIX6Z4uGLabFhmq/aPfU55noI54gh4xVKrs7LKpqYd aOexQACIOuVuHmktqpnUMhdZ/qO1Gzk9Fxm//zDVee/4CWAl/X1NSy4/HF0FGLFETi dxe3r+SKrQt0jGDtAmf3ItVUr2S8/g5s4Avv1U4MUZnKM6oUeHtqY/PRYH6FfCiLhD PLp++c+NQSzMVXU4aKlfJegtGhXGnrJOBF0SFvNW5HkP3eMzGiBqg7FjF+jfOc0Cer QbgNgThIZ/XwpmiG0P+bq+aMyybYRI9dKWz5m7H7BbQSHsRM9QYPReMjOyeha1n/f6 JXzbMGIybuwjg== From: Arnd Bergmann To: Bartosz Golaszewski , Linus Walleij , "Paul E. McKenney" Cc: Arnd Bergmann , Kent Gibson , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpio: cdev: avoid uninitialized variable dereference Date: Fri, 16 Feb 2024 13:59:50 +0100 Message-Id: <20240216125959.3766309-1-arnd@kernel.org> 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 From: Arnd Bergmann The 'gc' variable is never set before it gets printed: drivers/gpio/gpiolib-cdev.c:2802:11: error: variable 'gc' is uninitialized when used here [-Werror,-Wuninitialized] 2802 | chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id); | ^~ drivers/gpio/gpiolib.h:277:11: note: expanded from macro 'chip_dbg' 277 | dev_dbg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) | ^~ Use dev_dbg() directly. Fixes: 8574b5b47610 ("gpio: cdev: use correct pointer accessors with SRCU") Signed-off-by: Arnd Bergmann --- drivers/gpio/gpiolib-cdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 85037fa4925e..d6e8d2b7ac8f 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -2783,7 +2783,6 @@ static const struct file_operations gpio_fileops = { int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt) { - struct gpio_chip *gc; int ret; cdev_init(&gdev->chrdev, &gpio_fileops); @@ -2799,7 +2798,7 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt) if (!rcu_access_pointer(gdev->chip)) return -ENODEV; - chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id); + dev_dbg(&gdev->dev, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id); return 0; } -- 2.39.2