Message ID | 20210902174105.2418771-10-mcgrof@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: 5th batch of add_disk() error handling conversions | expand |
On Thu, Sep 02, 2021 at 10:41:05AM -0700, Luis Chamberlain wrote: > We never checked for errors on add_disk() as this function > returned void. Now that this is fixed, use the shiny new > error handling. > > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> > --- > drivers/s390/block/xpram.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c > index ce98fab4d43c..ed3904b6a9c8 100644 > --- a/drivers/s390/block/xpram.c > +++ b/drivers/s390/block/xpram.c > @@ -371,7 +371,9 @@ static int __init xpram_setup_blkdev(void) > disk->private_data = &xpram_devices[i]; > sprintf(disk->disk_name, "slram%d", i); > set_capacity(disk, xpram_sizes[i] << 1); > - add_disk(disk); > + rc = add_disk(disk); > + if (rc) > + goto out; Hmm, this is a more or less dead device driver, and I'm wondering if we shouldn't remove it instead. But anyway, your patch is not correct: - del_gendisk for all registered disks has to be called - unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME) is missing as well That would be more or or less xpram_exit with parameter. You can send a new patch or I can provide a proper one, whatever you prefer.
On Fri, Sep 03, 2021 at 04:06:15PM +0200, Heiko Carstens wrote: > On Thu, Sep 02, 2021 at 10:41:05AM -0700, Luis Chamberlain wrote: > > We never checked for errors on add_disk() as this function > > returned void. Now that this is fixed, use the shiny new > > error handling. > > > > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> > > --- > > drivers/s390/block/xpram.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c > > index ce98fab4d43c..ed3904b6a9c8 100644 > > --- a/drivers/s390/block/xpram.c > > +++ b/drivers/s390/block/xpram.c > > @@ -371,7 +371,9 @@ static int __init xpram_setup_blkdev(void) > > disk->private_data = &xpram_devices[i]; > > sprintf(disk->disk_name, "slram%d", i); > > set_capacity(disk, xpram_sizes[i] << 1); > > - add_disk(disk); > > + rc = add_disk(disk); > > + if (rc) > > + goto out; > > Hmm, this is a more or less dead device driver, and I'm wondering if > we shouldn't remove it instead. But anyway, your patch is not correct: > > - del_gendisk for all registered disks has to be called > - unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME) is missing as well > > That would be more or or less xpram_exit with parameter. > > You can send a new patch or I can provide a proper one, whatever you > prefer. You are more familiar with the code so it would be great if you can send a patch replacement and I will drop mine. I have quite a bit of other conversions to deal with. Luis
On Fri, Sep 03, 2021 at 04:06:15PM +0200, Heiko Carstens wrote: > Hmm, this is a more or less dead device driver, and I'm wondering if > we shouldn't remove it instead. But anyway, your patch is not correct: I'm all for removing it. I think we need to do a little more spring cleaning on unmaintained and likely to be unused block drivers.
On Mon, Sep 06, 2021 at 10:15:40AM +0100, Christoph Hellwig wrote: > On Fri, Sep 03, 2021 at 04:06:15PM +0200, Heiko Carstens wrote: > > Hmm, this is a more or less dead device driver, and I'm wondering if > > we shouldn't remove it instead. But anyway, your patch is not correct: > > I'm all for removing it. I think we need to do a little more spring > cleaning on unmaintained and likely to be unused block drivers. Yes, we'll remove it. I'll schedule it even for this merge window. Should be away with -rc1.
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index ce98fab4d43c..ed3904b6a9c8 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c @@ -371,7 +371,9 @@ static int __init xpram_setup_blkdev(void) disk->private_data = &xpram_devices[i]; sprintf(disk->disk_name, "slram%d", i); set_capacity(disk, xpram_sizes[i] << 1); - add_disk(disk); + rc = add_disk(disk); + if (rc) + goto out; } return 0;
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- drivers/s390/block/xpram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)