On 15/03/2018 11:08 PM, Bart Van Assche wrote: > Since bcache_device_free() checks the d->disk pointer I think that > means that that pointer can be NULL. Hence test that pointer before > using it. This was detected by smatch. > > Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx> Reviewed-by: Coly Li <colyli@xxxxxxx> Thanks. Coly Li > --- > drivers/md/bcache/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index d19a44cd1fd7..39bec137f636 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -742,7 +742,7 @@ static void bcache_device_free(struct bcache_device *d) > { > lockdep_assert_held(&bch_register_lock); > > - pr_info("%s stopped", d->disk->disk_name); > + pr_info("%s stopped", d->disk ? d->disk->disk_name : "(?)"); > > if (d->c) > bcache_device_detach(d); >