public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Wang Qing <wangqing@vivo.com>
Cc: Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rdma: delete the useless casting value returned
Date: Fri, 12 Mar 2021 09:10:02 -0400	[thread overview]
Message-ID: <20210312131002.GA2835774@nvidia.com> (raw)
In-Reply-To: <1615515570-1692-1-git-send-email-wangqing@vivo.com>

On Fri, Mar 12, 2021 at 10:19:30AM +0800, Wang Qing wrote:
> Fix the following coccicheck warning:
> WARNING: casting value returned by memory allocation function is useless.

This warning is wrong in this specific case.

The #define is creating a helper function that enforces strict type
safety on the user

So eg,

  struct bar *obj = rdma_zalloc_drv_obj(ibdev, ib_ah);

Will fail to compile because 'obj' is not the required ib_ah type

Jason

      reply	other threads:[~2021-03-12 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  2:19 [PATCH] rdma: delete the useless casting value returned Wang Qing
2021-03-12 13:10 ` Jason Gunthorpe [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=20210312131002.GA2835774@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=wangqing@vivo.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