mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: suijingfeng <suijingfeng@loongson.cn>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	error27@gmail.com
Subject: Re: [PATCH next] drm/loongson: Fix error handling in lsdc_pixel_pll_setup()
Date: Thu, 10 Aug 2023 21:30:14 +0800	[thread overview]
Message-ID: <44e4e8a8-b714-1cfd-c20c-d8151e73cdac@loongson.cn> (raw)
In-Reply-To: <20230720123950.543082-1-harshit.m.mogalapalli@oracle.com>

Hi,


On 2023/7/20 20:39, Harshit Mogalapalli wrote:
> There are two problems in lsdc_pixel_pll_setup()
> 1. If kzalloc() fails then call iounmap() to release the resources.
> 2. Both kzalloc and ioremap doesnot return error pointers on failure, so
>     using IS_ERR_OR_NULL() checks is a bit confusing and not very right,
>     fix this by changing those to NULL checks instead.
>
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>


Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>


> ---
> This is found with static analysis with smacth and only compile tested.
> ---
>   drivers/gpu/drm/loongson/lsdc_pixpll.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_pixpll.c b/drivers/gpu/drm/loongson/lsdc_pixpll.c
> index 04c15b4697e2..2609a2256da4 100644
> --- a/drivers/gpu/drm/loongson/lsdc_pixpll.c
> +++ b/drivers/gpu/drm/loongson/lsdc_pixpll.c
> @@ -120,12 +120,14 @@ static int lsdc_pixel_pll_setup(struct lsdc_pixpll * const this)
>   	struct lsdc_pixpll_parms *pparms;
>   
>   	this->mmio = ioremap(this->reg_base, this->reg_size);
> -	if (IS_ERR_OR_NULL(this->mmio))
> +	if (!this->mmio)
>   		return -ENOMEM;
>   
>   	pparms = kzalloc(sizeof(*pparms), GFP_KERNEL);
> -	if (IS_ERR_OR_NULL(pparms))
> +	if (!pparms) {
> +		iounmap(this->mmio);
>   		return -ENOMEM;
> +	}
>   
>   	pparms->ref_clock = LSDC_PLL_REF_CLK_KHZ;
>   


      reply	other threads:[~2023-08-10 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 12:39 Harshit Mogalapalli
2023-08-10 13:30 ` suijingfeng [this message]

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=44e4e8a8-b714-1cfd-c20c-d8151e73cdac@loongson.cn \
    --to=suijingfeng@loongson.cn \
    --cc=airlied@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®