Subject: Re: [PATCH] scsi: core: Fix early registration of sysfs attributes for scsi_device

From: Bart Van Assche <[email-masked]>
Date: Sun, 24 Oct 2021 14:25:26 -0700

On 10/24/21 04:18, Steffen Maier wrote:
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index c26f0e29e8cd..a3e37d3728df 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -1583,7 +1583,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
>   	scsi_enable_async_suspend(&sdev->sdev_gendev);
>   	dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu",
>   		     sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
> -	sdev->gendev_attr_groups[j++] = &scsi_sdev_attr_group;
> +	sdev->sdev_gendev.groups = sdev->gendev_attr_groups;
>   	if (hostt->sdev_groups) {
>   		for (i = 0; hostt->sdev_groups[i] &&
>   			     j < ARRAY_SIZE(sdev->gendev_attr_groups);

How about also updating the comment above the gendev_attr_groups
declaration since the above change makes that comment incorrect?

Thanks,

Bart.