From patchwork Fri Feb 16 05:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vinicius Costa Gomes X-Patchwork-Id: 201927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp307801dyb; Thu, 15 Feb 2024 21:18:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVCRR5hl1fiArQcq96sN6eJCa/trW7udMpCkuTwoJ7H2Dua1XxzNmRU/R3VpZUNTRqjhEKbK00mNg8h+PdJpCjiZw3L7Q== X-Google-Smtp-Source: AGHT+IFmJ5N/vGWYVcKaHq43Gmk2LaFU083yTOaKgJzS+21lyxIs882gfHFhX7frF6KP8n6wu63X X-Received: by 2002:a05:6402:165a:b0:561:f7da:ee30 with SMTP id s26-20020a056402165a00b00561f7daee30mr2251469edx.42.1708060708835; Thu, 15 Feb 2024 21:18:28 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cz27-20020a0564021cbb00b0056396c584c4si1258729edb.626.2024.02.15.21.18.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 21:18:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68066-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b="P6/WkIuk"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-68066-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68066-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6C6F21F24AF4 for ; Fri, 16 Feb 2024 05:18:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43306199AB; Fri, 16 Feb 2024 05:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P6/WkIuk" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 AD2B31401F; Fri, 16 Feb 2024 05:17:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708060622; cv=none; b=csvl1Ve5uR2dg6XGsX38xlw//99IXPmX+VVEUEfHXp5D7STZHICufzg6kzARK1ejHSCWucZ7uNXlBE2+spUOW98UszUzIE0zg02TQfAVx8tIUnqMjTYtsvLiYPK16Ewt0b/it4DcFxoeWJxU7zc6cAaiY07SvR6qMldidlgYCLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708060622; c=relaxed/simple; bh=WuYpU7Tl3Hur5yBPxFGUFGTbvu6gUXpdmpQ3/MOYgP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EbOq+tEqGmdG3c/i2yqT0Zojwf8RQNWDzHeYybMROxiqyw5s7I4nm0BC8YEmHZH7naIW88BhsJUSZN1qMEq1kMwxCoUe+8zRX73M74qkhLNlFHySCPs686ghGg1qGOiJUwArYkVAWTjAJeO7O5OlsiPXwj8CW2cgquFf7ls+nkc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=P6/WkIuk; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708060620; x=1739596620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WuYpU7Tl3Hur5yBPxFGUFGTbvu6gUXpdmpQ3/MOYgP8=; b=P6/WkIukM1WMIcrK5jB/PJtlx3+pm40IBnHV1UZIrCuWbqfQpwuSAZeo ZI1bhFLCqHeHgJiDRd5fjcAEv9egOJgYkGU7U/mRI3y5SA39b7Ylf18fL 1/IMlaON17vpu6azAqozSp9CgAML7JX2Gn+/b4LfCGPe+iVfkoIDk8pnk bojIgfceUdMy4WkS+BL7/HtWOXLxkEv6/OhNZPxaoR8t14ZE7upc+LPu1 bW+NAlbjpAnidW52/HD4Xi8otYAkyb+xoeXtHTLhAMcnhIpRihKrKEuDA Eepu5TLZh3Mo9v+lPmbBsVB4UcOtdqhBp7Wwn8JISETI2c/JPmZ7LlF0S w==; X-IronPort-AV: E=McAfee;i="6600,9927,10985"; a="5149345" X-IronPort-AV: E=Sophos;i="6.06,163,1705392000"; d="scan'208";a="5149345" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2024 21:16:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,163,1705392000"; d="scan'208";a="4063888" Received: from lvngo-mobl1.amr.corp.intel.com (HELO vcostago-mobl3.intel.com) ([10.125.17.186]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2024 21:16:57 -0800 From: Vinicius Costa Gomes To: brauner@kernel.org, amir73il@gmail.com, hu1.chen@intel.com Cc: miklos@szeredi.hu, malini.bhandaru@intel.com, tim.c.chen@intel.com, mikko.ylinen@intel.com, lizhen.you@intel.com, linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Vinicius Costa Gomes Subject: [RFC v3 2/5] cleanup: Fix discarded const warning when defining guard Date: Thu, 15 Feb 2024 21:16:37 -0800 Message-ID: <20240216051640.197378-3-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240216051640.197378-1-vinicius.gomes@intel.com> References: <20240216051640.197378-1-vinicius.gomes@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791031465522285764 X-GMAIL-MSGID: 1791031465522285764 When defining guards for const types the void* return implicitly discards the const modifier. Be explicit about it. Compiler warning (gcc 13.2.1): /include/linux/cleanup.h:154:18: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 154 | { return *_T; } | ^~~ /include/linux/cred.h:193:1: note: in expansion of macro ‘DEFINE_GUARD’ 193 | DEFINE_GUARD(cred, const struct cred *, _T = override_creds_light(_T), | ^~~~~~~~~~~~ Signed-off-by: Vinicius Costa Gomes --- include/linux/cleanup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h index 085482ef46c8..c0347eb137a5 100644 --- a/include/linux/cleanup.h +++ b/include/linux/cleanup.h @@ -151,7 +151,7 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ #define DEFINE_GUARD(_name, _type, _lock, _unlock) \ DEFINE_CLASS(_name, _type, if (_T) { _unlock; }, ({ _lock; _T; }), _type _T); \ static inline void * class_##_name##_lock_ptr(class_##_name##_t *_T) \ - { return *_T; } + { return (void *)*_T; } #define DEFINE_GUARD_COND(_name, _ext, _condlock) \ EXTEND_CLASS(_name, _ext, \