Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4785568ybb; Tue, 14 Apr 2020 14:09:16 -0700 (PDT) X-Google-Smtp-Source: APiQypIuHEOtygekyg5S1vOCnhHBcLvHeTV6fxaC+lG2HiQHllrDlcklXoL6kmObgeHwdHgY9EB+ X-Received: by 2002:a50:b003:: with SMTP id i3mr22185005edd.303.1586898555994; Tue, 14 Apr 2020 14:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586898555; cv=none; d=google.com; s=arc-20160816; b=M2kBGjl4fOCS3bJEYZGRRxKZstIkiHgEkf5xUUn7jz88jyCofynfCz2UMmQbFsyvgZ 9d+u00fZrwlPm1r5MKNO3NnULPKtkm0yXCy1VqlaT+DGCb1NwOgAjU8liIxhslAnHPj8 QRRUW7zKi3z5uyxvQvIw8VRVv7L+hGdsjr+Xd0crcX3SxmA74Xj6Cw3+NilLexMqp5AU BSHTZ1iQc1IKu1Gv/YGcg/t6S6g7Z8xEx2al1v7tMQicp+qOYl4plpg8JzZRrPtskN5F V6aIj4PqKZZx4X5a1sJXuQc4SGH6/hud3spRjiQbCPUTwCskB76dhAywUUUr1rlI2syp 67hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QM7eJqLTb+rh4BsFkeLUpMe9kom0uFPtW4+eU4P79ns=; b=nDmy/X7gAq5qooOI47DUgt2qIs1/vJ0vz652oD76t5/SUWzjW+KfHjCSxoiVkoWo7M qArS/PV3KcEtCrFUG82uOB1JsGAOzC0zQYkyZx2V2J+JQ74IubthOpqLungaM0Ro95Gt kf89x3bGHujb8ZEKj6o5t8IYkHwHmNqBoE7yf0DCq3Kj1s2bQCl/Gv+qBS1/EMq8vUkr nAlUWXkl7t1iOjfHbsdk43YagmDbIDu2FO0PbfUjv8D3pZNj7tVThnuaZPPQgXFtGQ63 5xUahim//a1ivfvTCpGuBo7cw8mOZMJFmf/r2StNk8/7+c/Jex4yYC3t1gZSsIsQNlqu 4JiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si8615378eja.160.2020.04.14.14.08.43; Tue, 14 Apr 2020 14:09:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733037AbgDMSjC (ORCPT + 99 others); Mon, 13 Apr 2020 14:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1733019AbgDMSi7 (ORCPT ); Mon, 13 Apr 2020 14:38:59 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F957C008749; Mon, 13 Apr 2020 11:38:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id F06E22A12DF Received: by jupiter.universe (Postfix, from userid 1000) id 4F0404800EA; Mon, 13 Apr 2020 20:38:55 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCH 1/4] power: supply: core: Constify usb_types Date: Mon, 13 Apr 2020 20:38:50 +0200 Message-Id: <20200413183853.1088823-2-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200413183853.1088823-1-sebastian.reichel@collabora.com> References: <20200413183853.1088823-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org usb_types is a list of USB types supported by the hardware, which does not change at runtime. Let's mark it as const for improved security. Signed-off-by: Sebastian Reichel --- drivers/power/supply/power_supply_sysfs.c | 2 +- include/linux/power_supply.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index f37ad4eae60b..45dafc1820ff 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -78,7 +78,7 @@ static const char * const power_supply_scope_text[] = { }; static ssize_t power_supply_show_usb_type(struct device *dev, - enum power_supply_usb_type *usb_types, + const enum power_supply_usb_type *usb_types, ssize_t num_usb_types, union power_supply_propval *value, char *buf) diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index dcd5a71e6c67..0392c9cc8f1c 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -223,7 +223,7 @@ struct power_supply_config { struct power_supply_desc { const char *name; enum power_supply_type type; - enum power_supply_usb_type *usb_types; + const enum power_supply_usb_type *usb_types; size_t num_usb_types; enum power_supply_property *properties; size_t num_properties; -- 2.25.1