linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	"Jarkko Lavinen" <jarkko.lavinen@nokia.com>,
	"Rui Miguel Silva" <rmfrfs@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	devel@driverdev.osuosl.org,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Pierre Ossman" <pierre@ossman.eu>,
	"Johan Hovold" <johan@kernel.org>, "Alex Dubov" <oakad@yahoo.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Tony Olech" <tony.olech@elandigitalsystems.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sascha Sommer" <saschasommer@freenet.de>,
	adi-buildroot-devel@lists.sourceforge.net,
	"Ben Dooks" <ben-linux@fluff.org>,
	"Alex Elder" <elder@kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Tony Prisk" <linux@prisktech.co.nz>,
	linux-omap@vger.kernel.org,
	"Manuel Lauss" <manuel.lauss@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Ludovic Desroches" <ludovic.desroches@atmel.com>,
	linux-usb@vger.kernel.org, "Bruce Chang" <brucechang@via.com.tw>,
	"Sonic Zhang" <sonic.zhang@analog.com>,
	"Harald Welte" <HaraldWelte@viatech.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Maxime Ripard" <maxime.ripard@free-electrons.com>
Subject: Re: [PATCH 0/2] mmc: allow mmc_alloc_host() and tmio_mmc_host_alloc()
Date: Fri, 11 Nov 2016 12:19:05 +0900	[thread overview]
Message-ID: <CAK7LNAThxsE3QW4EdPUyxmxbnt_PPjeogi8Fox5AHkddsuu-Sg@mail.gmail.com> (raw)
In-Reply-To: <20161110133559.GA10191@kroah.com>

2016-11-10 22:35 GMT+09:00 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> On Thu, Nov 10, 2016 at 10:24:21PM +0900, Masahiro Yamada wrote:
>>
>> sdhci_alloc_host() returns an error pointer when it fails.
>> but mmc_alloc_host() cannot.
>>
>> This series allow to propagate a proper error code
>> when host-allocation fails.
>
> Why?  What can we really do about the error except give up?  Why does
> having a explicit error value make any difference to the caller, they
> can't do anything different, right?


The error code is shown in the console, like

  probe of 5a000000.sdhc failed with error -12


The proper error code will give a clue
why the driver failed to probe.


> I suggest just leaving it as-is, it's simple, and you don't have to mess
> with PTR_ERR() anywhere.


Why?

Most of driver just give up probing for any error,
but we still do ERR_PTR()/PTR_ERR() here and there.
I think this patch is the same pattern.

If a function returns NULL on failure, we need to think about
"what is the most common failure case".

Currently, MMC drivers assume -ENOMEM is the best
fit for mmc_alloc_host(), but the assumption is fragile.

Already, mmc_alloc_host() calls a function
that returns not only -ENOMEM, but also -ENOSPC.

In the future, some other failure cases might be
added to mmc_alloc_host().

Once we decide the API returns an error pointer,
drivers just propagate the return value from the API.
This is much more stable implementation.



-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2016-11-11  3:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 13:24 [PATCH 0/2] mmc: allow mmc_alloc_host() and tmio_mmc_host_alloc() Masahiro Yamada
2016-11-10 13:24 ` [PATCH 1/2] mmc: allow mmc_alloc_host() to return proper error code Masahiro Yamada
2016-11-10 13:24 ` [PATCH 2/2] mmc: tmio: allow tmio_mmc_host_alloc() " Masahiro Yamada
2016-11-10 13:35 ` [PATCH 0/2] mmc: allow mmc_alloc_host() and tmio_mmc_host_alloc() Greg Kroah-Hartman
2016-11-11  3:19   ` Masahiro Yamada [this message]
2016-11-13 10:58     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAThxsE3QW4EdPUyxmxbnt_PPjeogi8Fox5AHkddsuu-Sg@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=HaraldWelte@viatech.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=adrian.hunter@intel.com \
    --cc=ben-linux@fluff.org \
    --cc=brucechang@via.com.tw \
    --cc=devel@driverdev.osuosl.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko.lavinen@nokia.com \
    --cc=jh80.chung@samsung.com \
    --cc=johan@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@prisktech.co.nz \
    --cc=ludovic.desroches@atmel.com \
    --cc=manuel.lauss@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=nico@fluxnic.net \
    --cc=oakad@yahoo.com \
    --cc=pierre@ossman.eu \
    --cc=rmfrfs@gmail.com \
    --cc=saschasommer@freenet.de \
    --cc=sonic.zhang@analog.com \
    --cc=tony.olech@elandigitalsystems.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wens@csie.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).