From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796220077; b=YkzzdJBzaWHbidWC+dmVt+mjM6iIkdH3xOQlOfkk88XKGI5CrMbiGrHkVaZlleiTN6cV LTn9zN9HX+fpGE1XLDZcfzxMr17+GCJzVfOYT0YSz1eWBUwzyLYv12rn40oJchAyYzDXE 3Knch/0vdGJhDJsyAarQjEipjbY4p7kadXPF45/P1Xf7C+8U385SjDiN6rN1kJUbRMIrF s75yjFXsS8nwI0lOf0MVrgoGvQvC1XfELtQpWGI3SVwXS0D8a4XNPkV2++djBzCwJ7zal KUG9M2a3X87Rsytl+8Bo3y5UAnmI/+BHuaEueA1ePQejwM/Y33GpSCudsC98cZs9/eQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220077; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition; bh=N+HBDrl1UU0AGq86n4dWMkLRszATeoVLPOpaPAafC/M=; b=AKmRFLPzffIO4AWvwmUBvjn0RjrwtJ78KXXHbdso3j0BEprQa8LGUOdKOVM96NQ4Ssyy PGlREA7+ZJDiU26YoWbFkQ1uuex7wCy5cHl1xWShxLYUsmc+HEuHSt6HZYuzQfGNGuDlv fgoyvdZa1RZg5QaesOMhmJgJkrBAYkxn4YoD+Q1Q8mrhiTdw46Rm6IvNc42fJMbJaT1L3 bYo0KqsgY8/Bsxe2a9z4dObCcpiUjSmhF1v2GIkGUwXFBEdLEE/2L8Ne3h/lsEQF156+M sdEgobggc0IggbVodIbMZ+jsarYx1Gpk5Pg5+6KLfcuLv3s/DHlYCCAyVOnl2xa8WfQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="jkvukp8/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1504606A31A; Wed, 2 Dec 2026 14:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jkvukp8/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF0E61F00893; Wed, 2 Dec 2026 14:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796220077; bh=N+HBDrl1UU0AGq86n4dWMkLRszATeoVLPOpaPAafC/M=; h=Date:From:To:Cc:Subject; b=jkvukp8/8UhbDk+L4U+vjBTuGbDeySwdIMQvVnKHK8hANcyomYChw4PvF38RIUS6E kLpnPmawIL8Dyo6jb2j920n+N+78hbU1MW3C3jsUTeUjTTDmCtdXiVchqyEvj55gqB 0kZkNFf8M/FMjFQqjty6ubb5pvcNcQMpMgeeNUc+Zwv1d36609TY684QirKHlfX/ew C8DHRX7mvQRx9EBJnGtbuyQl+pGZG6/9ZCC24nJb6zdIxyfPUWTL5ZS7gNxc1uv8Iy uDyrG7Bsgv2avOtR4AONTx4vWe10Ha2IyAHKlP1KHxWKueezXHnS2bsTdw4GaosxUX HQwEvETuAvXkw== Date: Wed, 2 Dec 2026 14:01:13 +0000 From: Mark Brown To: Srinivas Kandagatla Cc: Bartosz Golaszewski , Kees Cook , Kees Cook , Linux Kernel Mailing List , Linux Next Mailing List Subject: linux-next: manual merge of the nvmem tree with the origin tree Message-ID: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2taV2H/u9kiN7mNg" Content-Disposition: inline --2taV2H/u9kiN7mNg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, Today's linux-next merge of the nvmem tree got a conflict in: drivers/nvmem/core.c between commit: 4dd10fbbeb9c3 ("treewide: Convert devm_kmalloc() family to the devm_kmall= oc_obj() family") =66rom the origin tree and commit: 96139b973a2a5 ("nvmem: don't use devres in subsystem code") =66rom the nvmem tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. diff --combined drivers/nvmem/core.c index fe9b8a3a5ea02,b5af34e523b67..0000000000000 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@@ -184,24 -184,25 +184,25 @@@ static struct lock_class_key eeprom_loc #endif =20 static ssize_t type_show(struct device *dev, - struct device_attribute *attr, char *buf) + const struct device_attribute *attr, char *buf) { struct nvmem_device *nvmem =3D to_nvmem_device(dev); =20 return sysfs_emit(buf, "%s\n", nvmem_type_str[nvmem->type]); } =20 - static DEVICE_ATTR_RO(type); + static const DEVICE_ATTR_RO(type); =20 - static ssize_t force_ro_show(struct device *dev, struct device_attribute = *attr, - char *buf) + static ssize_t force_ro_show(struct device *dev, + const struct device_attribute *attr, char *buf) { struct nvmem_device *nvmem =3D to_nvmem_device(dev); =20 return sysfs_emit(buf, "%d\n", nvmem->read_only); } =20 - static ssize_t force_ro_store(struct device *dev, struct device_attribute= *attr, + static ssize_t force_ro_store(struct device *dev, + const struct device_attribute *attr, const char *buf, size_t count) { struct nvmem_device *nvmem =3D to_nvmem_device(dev); @@@ -213,9 -214,9 +214,9 @@@ return count; } =20 - static DEVICE_ATTR_RW(force_ro); + static const DEVICE_ATTR_RW(force_ro); =20 - static struct attribute *nvmem_attrs[] =3D { + static const struct attribute *const nvmem_attrs[] =3D { &dev_attr_force_ro.attr, &dev_attr_type.attr, NULL, @@@ -334,7 -335,7 +335,7 @@@ static size_t nvmem_bin_attr_size(struc } =20 static umode_t nvmem_attr_is_visible(struct kobject *kobj, - struct attribute *attr, int i) + const struct attribute *attr, int i) { struct device *dev =3D kobj_to_dev(kobj); struct nvmem_device *nvmem =3D to_nvmem_device(dev); @@@ -412,10 -413,10 +413,10 @@@ static const struct bin_attribute *cons =20 static const struct attribute_group nvmem_bin_group =3D { .bin_attrs =3D nvmem_bin_attributes, - .attrs =3D nvmem_attrs, + .attrs_const =3D nvmem_attrs, .is_bin_visible =3D nvmem_bin_attr_is_visible, .bin_size =3D nvmem_bin_attr_size, - .is_visible =3D nvmem_attr_is_visible, + .is_visible_const =3D nvmem_attr_is_visible, }; =20 static const struct attribute_group *nvmem_dev_groups[] =3D { @@@ -478,12 -479,7 +479,7 @@@ static void nvmem_sysfs_remove_compat(s =20 static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem) { - struct attribute_group group =3D { - .name =3D "cells", - }; struct nvmem_cell_entry *entry; - const struct bin_attribute **pattrs; - struct bin_attribute *attrs; unsigned int ncells =3D 0, i =3D 0; int ret; =20 @@@ -494,43 -490,72 +490,72 @@@ =20 /* Allocate an array of attributes with a sentinel */ ncells =3D list_count_nodes(&nvmem->cells); - pattrs =3D devm_kzalloc_objs(&nvmem->dev, *pattrs, ncells + 1); +=20 + const struct bin_attribute **pattrs __free(kfree) =3D kzalloc_objs(*patt= rs, ncells + 1); if (!pattrs) return -ENOMEM; =20 - attrs =3D devm_kzalloc_objs(&nvmem->dev, struct bin_attribute, ncells); + struct bin_attribute *attrs __free(kfree) =3D kzalloc_objs(*attrs, ncell= s); if (!attrs) return -ENOMEM; =20 /* Initialize each attribute to take the name and size of the cell */ list_for_each_entry(entry, &nvmem->cells, node) { sysfs_bin_attr_init(&attrs[i]); - attrs[i].attr.name =3D devm_kasprintf(&nvmem->dev, GFP_KERNEL, - "%s@%x,%x", entry->name, - entry->offset, - entry->bit_offset); + attrs[i].attr.name =3D kasprintf(GFP_KERNEL, "%s@%x,%x", entry->name, + entry->offset, entry->bit_offset); + if (!attrs[i].attr.name) { + list_for_each_entry_continue_reverse(entry, &nvmem->cells, node) + kfree(attrs[--i].attr.name); + return -ENOMEM; + } +=20 attrs[i].attr.mode =3D 0444 & nvmem_bin_attr_get_umode(nvmem); attrs[i].size =3D entry->bytes; attrs[i].read =3D &nvmem_cell_attr_read; attrs[i].private =3D entry; - if (!attrs[i].attr.name) - return -ENOMEM; =20 pattrs[i] =3D &attrs[i]; i++; } =20 - group.bin_attrs =3D pattrs; + memset(&nvmem->sysfs_group, 0, sizeof(nvmem->sysfs_group)); + nvmem->sysfs_group.name =3D "cells"; + nvmem->sysfs_group.bin_attrs =3D pattrs; =20 - ret =3D device_add_group(&nvmem->dev, &group); - if (ret) + ret =3D device_add_group(&nvmem->dev, &nvmem->sysfs_group); + if (ret) { + i =3D 0; + list_for_each_entry(entry, &nvmem->cells, node) + kfree(attrs[i++].attr.name); return ret; + } =20 nvmem->sysfs_cells_populated =3D true; + nvmem->sysfs_attrs =3D no_free_ptr(attrs); + nvmem->sysfs_pattrs =3D no_free_ptr(pattrs); =20 return ret; } =20 + static void nvmem_sysfs_remove_cells(struct nvmem_device *nvmem) + { + int i; +=20 + if (!nvmem->sysfs_cells_populated) + return; +=20 + device_remove_group(&nvmem->dev, &nvmem->sysfs_group); +=20 + for (i =3D 0; nvmem->sysfs_pattrs[i]; i++) + kfree(nvmem->sysfs_pattrs[i]->attr.name); +=20 + kfree(nvmem->sysfs_attrs); + kfree(nvmem->sysfs_pattrs); +=20 + nvmem->sysfs_cells_populated =3D false; + } +=20 #else /* CONFIG_NVMEM_SYSFS */ =20 static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, @@@ -541,6 -566,9 +566,9 @@@ static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem) { } + static void nvmem_sysfs_remove_cells(struct nvmem_device *nvmem) + { + } =20 #endif /* CONFIG_NVMEM_SYSFS */ =20 @@@ -1115,6 -1143,8 +1143,8 @@@ void nvmem_unregister(struct nvmem_devi =20 nvmem_sysfs_remove_compat(nvmem); nvmem_destroy_layout(nvmem); + nvmem_sysfs_remove_cells(nvmem); + kfree(ops); =20 device_unregister(&nvmem->dev); } --2taV2H/u9kiN7mNg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmsQJKgACgkQJNaLcl1U h9AGpgf/XP2ROsheXRNRuh+sGUMl650TlLQ9Z95D7hu/CWnWsPVVE1omSh39Ichf j/5Ra6Br4m0GDvNrYe8UD9xyh5kdGBOoU0EAT172uwO/VBv+IKcX3seClaTBbO+5 oONKAth0NdWv3MA/Gng0exTBaQ1SQcxHmLzLuDrMgbtVdiZO5PM5kZ3ikuWMYGSm 0CzlkBelbsVlrX5onKukvThBn3t032Pucg2CS7s5FR2ZKs1rNx/CioxKkeHuEv7i Cw6uaDWVmkZumUY+t+laa0KoohJHyfOFnwJLe49/QDuYTOk2BOhvGcI/g7UvfByz 4tWNdDov/0oi7gAGtv8ID2RnBiubRA== =A2yj -----END PGP SIGNATURE----- --2taV2H/u9kiN7mNg--