axonram: Fix gendisk handling
authorJan Kara <jack@suse.cz>
Wed, 8 Mar 2017 13:56:05 +0000 (14:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:28:21 +0000 (09:28 +0100)
commite8d5b115c6ea552d720315b4d6413ea6650d9966
tree724dbc13532847393ba907c68453a251828a06ce
parent8818eb851c2d9c9e503208f5b054e42b4a83fe24
axonram: Fix gendisk handling

[ Upstream commit 672a2c87c83649fb0167202342ce85af9a3b4f1c ]

It is invalid to call del_gendisk() when disk->queue is NULL. Fix error
handling in axon_ram_probe() to avoid doing that.

Also del_gendisk() does not drop a reference to gendisk allocated by
alloc_disk(). That has to be done by put_disk(). Add that call where
needed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/sysdev/axonram.c