Re: [PATCH v5 2/5] mmc: block: Support alternative_gpt_sector() operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



18.08.2021 08:28, Christoph Hellwig пишет:
> On Wed, Aug 18, 2021 at 03:55:44AM +0300, Dmitry Osipenko wrote:
>> +static int mmc_blk_alternative_gpt_sector(struct block_device *bdev,
>> +					  sector_t *sector)
>> +{
>> +	struct mmc_card *card = mmc_bdev_to_card(bdev);
>> +
>> +	if (!card)
>> +		return -ENODEV;
>> +
>> +	if (!card->host->ops->alternative_gpt_sector)
>> +		return -EOPNOTSUPP;
>> +
>> +	return card->host->ops->alternative_gpt_sector(card, sector);
>> +}
>> +
> 
>> +static struct mmc_card *mmc_bdev_to_card(struct block_device *bdev)
>> +{
>> +	struct mmc_blk_data *md;
>> +
>> +	if (bdev->bd_disk->fops != &mmc_bdops)
>> +		return NULL;
> 
> No need for this check bow that it is only called through mmc_bdops.

Alright

>> +
>> +	md = mmc_blk_get(bdev->bd_disk);
>> +	if (!md)
>> +		return NULL;
>> +
>> +	return md->queue.card;
>> +}
> 
> This reference seems to never be dropped anywhere.
> 

Indeed, I missed that it bumps the refcnt.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux