lkml.org 
[lkml]   [2018]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v5 08/11] scsi: host template attribute groups
Date
On Tue, 2018-02-06 at 18:06 +0200, Stanislav Nijnikov wrote:
> + if (sdev->host->hostt->sdev_groups) {
> + error = sysfs_create_groups(&sdev->sdev_gendev.kobj,
> + sdev->host->hostt->sdev_groups);
> + if (error)
> + return error;
> + }

Please follow the indentation style that is used elsewhere in the kernel and
move the sdev->host->hostt->sdev_groups argument to the right such that it
starts one position to the right of the sysfs_create_groups() opening
parenthesis. Please also indent the if (error) statement correctly.

> @@ -1326,6 +1333,11 @@ void __scsi_remove_device(struct scsi_device *sdev)
> if (sdev->sdev_state == SDEV_DEL)
> return;
>
> + if (sdev->host->hostt->sdev_groups) {
> + sysfs_remove_groups(&sdev->sdev_gendev.kobj,
> + sdev->host->hostt->sdev_groups);
> + }

If sdev->is_visible is false then the device_add() call for sdev->sdev_gendev
may have failed so calling sysfs_remove_groups() is not necessary. Please move
this call down to just before the device_del(dev) since that call also removes
sysfs attributes. Additionally, I think that checkpatch will complain about the
above code and will report that braces are not necessary for single-line
statements?

Thanks,

Bart.



\
 
 \ /
  Last update: 2018-02-06 20:06    [W:0.109 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site