linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Q: return of pinctrl_register and handing at drivers that use this function
@ 2012-06-18 11:47 devendra.aaru
  2012-06-18 11:52 ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: devendra.aaru @ 2012-06-18 11:47 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren, linux-kernel

Hi,

since the pinctrl_register returns a pointer of structure type "struct
pinctrl_dev" or NULL if it was failed to register the pinctrl driver,
so IS_ERR checking is not required?

My understanding about IS_ERR is that its used when the pointer
addresses are kind of error codes rather actual addresses,
but are a kind of return codes of functions returning integer types.

Please correct me if my understanding is not correct.

Thanks,
Devendra.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-18 11:47 Q: return of pinctrl_register and handing at drivers that use this function devendra.aaru
@ 2012-06-18 11:52 ` Linus Walleij
  2012-06-18 12:04   ` devendra.aaru
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2012-06-18 11:52 UTC (permalink / raw)
  To: devendra.aaru; +Cc: Stephen Warren, linux-kernel

On Mon, Jun 18, 2012 at 1:47 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:

> since the pinctrl_register returns a pointer of structure type "struct
> pinctrl_dev" or NULL if it was failed to register the pinctrl driver,
> so IS_ERR checking is not required?

Yes. (Unless I did something wrong.)

> My understanding about IS_ERR is that its used when the pointer
> addresses are kind of error codes rather actual addresses,
> but are a kind of return codes of functions returning integer types.

You are absolutely right.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-18 11:52 ` Linus Walleij
@ 2012-06-18 12:04   ` devendra.aaru
  2012-06-18 14:38     ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: devendra.aaru @ 2012-06-18 12:04 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Stephen Warren, linux-kernel

Hi Linus,

On Mon, Jun 18, 2012 at 5:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Jun 18, 2012 at 1:47 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>
>> since the pinctrl_register returns a pointer of structure type "struct
>> pinctrl_dev" or NULL if it was failed to register the pinctrl driver,
>> so IS_ERR checking is not required?
>
> Yes. (Unless I did something wrong.)
>
So checking the return value of pinctrl_register with IS_ERR is not required.
There are drivers in pinctrl subsystem which uses the IS_ERR and may (not)
check whether its null or not.

you can expect a patchset of those fixes. :)
> Yours,
> Linus Walleij

Thanks,
Devendra.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-18 12:04   ` devendra.aaru
@ 2012-06-18 14:38     ` Linus Walleij
  2012-06-18 14:42       ` devendra.aaru
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2012-06-18 14:38 UTC (permalink / raw)
  To: devendra.aaru; +Cc: Stephen Warren, linux-kernel

On Mon, Jun 18, 2012 at 2:04 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:

> So checking the return value of pinctrl_register with IS_ERR is not required.

Nope.

> There are drivers in pinctrl subsystem which uses the IS_ERR and may (not)
> check whether its null or not.
>
> you can expect a patchset of those fixes. :)

Good :-)

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-18 14:38     ` Linus Walleij
@ 2012-06-18 14:42       ` devendra.aaru
  2012-06-20  7:52         ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: devendra.aaru @ 2012-06-18 14:42 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Stephen Warren, linux-kernel

Hi Linus,

On Mon, Jun 18, 2012 at 8:08 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Jun 18, 2012 at 2:04 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>
>> So checking the return value of pinctrl_register with IS_ERR is not required.
>
> Nope.

You mean to say that the check "IS_ERR(ret_ptr)" is not required? or
the other way like
its also needed.

sorry for my poor understanding.

> Thanks,
> Linus Walleij

Thanks,
Devendra.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-18 14:42       ` devendra.aaru
@ 2012-06-20  7:52         ` Linus Walleij
  2012-06-20 17:08           ` devendra.aaru
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2012-06-20  7:52 UTC (permalink / raw)
  To: devendra.aaru; +Cc: Stephen Warren, linux-kernel

On Mon, Jun 18, 2012 at 4:42 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
> On Mon, Jun 18, 2012 at 8:08 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Mon, Jun 18, 2012 at 2:04 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>>
>>> So checking the return value of pinctrl_register with IS_ERR is not required.
>>
>> Nope.
>
> You mean to say that the check "IS_ERR(ret_ptr)" is not required? or
> the other way like its also needed.

I mean it shall be tested like this:

if (!pinmctrl_register(&foo)) {
    /* error case */
}

No IS_ERR() business.

Linus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Q: return of pinctrl_register and handing at drivers that use this function
  2012-06-20  7:52         ` Linus Walleij
@ 2012-06-20 17:08           ` devendra.aaru
  0 siblings, 0 replies; 7+ messages in thread
From: devendra.aaru @ 2012-06-20 17:08 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Stephen Warren, linux-kernel

Hi Linus,

On Wed, Jun 20, 2012 at 1:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> I mean it shall be tested like this:
>
> if (!pinmctrl_register(&foo)) {
>    /* error case */
> }
>
> No IS_ERR() business.
>
Yeah, and you already took the changes into your brach :-). Thanks!
> Linus

Devendra

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-20 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-18 11:47 Q: return of pinctrl_register and handing at drivers that use this function devendra.aaru
2012-06-18 11:52 ` Linus Walleij
2012-06-18 12:04   ` devendra.aaru
2012-06-18 14:38     ` Linus Walleij
2012-06-18 14:42       ` devendra.aaru
2012-06-20  7:52         ` Linus Walleij
2012-06-20 17:08           ` devendra.aaru

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).