[3/3,media] s5p-mfc: Adjust a null pointer check in four functions

Message ID e794361b-8f2a-7457-007f-72ef4fa66d02@users.sourceforge.net
State New
Headers show
Series
  • S5P MFC: Adjustments for five function implementations
Related show

Commit Message

SF Markus Elfring Sept. 8, 2017, 8:53 p.m.
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 22:37:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Sylwester Nawrocki Sept. 11, 2017, 9:21 a.m. | #1
On 09/08/2017 10:53 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>

> Date: Fri, 8 Sep 2017 22:37:00 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit

Can you resend with that 4 lines removed? Are you using git send-email
for sending patches?

--
Thanks,
Sylwester
SF Markus Elfring Sept. 11, 2017, 7:21 p.m. | #2
>> Date: Fri, 8 Sep 2017 22:37:00 +0200
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
> 
> Can you resend with that 4 lines removed?

* Do you care to preserve an information like the author date?

* Would you like to support special characters in the commit message?


> Are you using git send-email for sending patches?

Not so far.

Regards,
Markus
Sylwester Nawrocki Sept. 12, 2017, 1:21 p.m. | #3
On 09/11/2017 09:21 PM, SF Markus Elfring wrote:
>>> Date: Fri, 8 Sep 2017 22:37:00 +0200
>>> MIME-Version: 1.0
>>> Content-Type: text/plain; charset=UTF-8
>>> Content-Transfer-Encoding: 8bit
>>
>> Can you resend with that 4 lines removed?
> 
> * Do you care to preserve an information like the author date?

In this case not, but actually the Date line is not an issue.  Anyway
the patch is malformed, please try to save your posted patch and apply
with git am and see how finally the commit message looks like.

> * Would you like to support special characters in the commit message?

I can't see any need for special characters in the patch itself.
Please submit the patch in a way that it can be applied properly with
patchwork client (or git am).

>> Are you using git send-email for sending patches?
> 
> Not so far.

I would suggest switching to git send-email, then issues like
above could be easily avoided.

--
Regards,
Sylwester
SF Markus Elfring Sept. 12, 2017, 3 p.m. | #4
>> * Do you care to preserve an information like the author date?
>
> In this case not, but actually the Date line is not an issue.

Thanks for your information.

It seems then that you quoted a line too much.


> Anyway the patch is malformed, …

I have got doubts for this view because the file was automatically generated
by the command “git format-patch” also for the discussed three update steps.

Regards,
Markus
Sylwester Nawrocki Sept. 12, 2017, 5:41 p.m. | #5
On 09/12/2017 05:00 PM, SF Markus Elfring wrote:
>>> * Do you care to preserve an information like the author date?
>> In this case not, but actually the Date line is not an issue.
> Thanks for your information.
> 
> It seems then that you quoted a line too much.
>  
>> Anyway the patch is malformed, …
 >
> I have got doubts for this view because the file was automatically generated
> by the command “git format-patch” also for the discussed three update steps.

Generating patch is only part of the story, it seems the patch is not sent
properly and tags which should be in SMTP header end up in the message
body. I think there would not be such issues if you have used git format-patch
+ git send-email.

I normally do amend things like this while applying, I will do that this time 
as well. It's already too much time wasted for such a dubious patch.
SF Markus Elfring Sept. 12, 2017, 8:33 p.m. | #6
> Generating patch is only part of the story,

I can follow this view in principle.


> it seems the patch is not sent properly

I got an other impression.


> and tags which should be in SMTP header end up in the message body.

I agree that extra message fields were presented by the git software for
a reason.
You might have got other opinions about the original reason (than me).


> I think there would not be such issues if you have used git
> format-patch + git send-email.

I have got also doubts about your corresponding expectations when you
would find
the proposed commit message itself acceptable (besides the small source
code changes).


> I normally do amend things like this while applying,

That is interesting.


> I will do that this time as well.

Such an action can also be nice.


> It's already too much time wasted for such a dubious patch.

A bit of time is needed to resolve a temporary disagreement.

Regards,
Markus

Patch

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index abfb70b07032..cf68aed59e0d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -470,7 +470,7 @@  static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev,
 {
 	mfc_err("Interrupt Error: %08x\n", err);
 
-	if (ctx != NULL) {
+	if (ctx) {
 		/* Error recovery is dependent on the state of context */
 		switch (ctx->state) {
 		case MFCINST_RES_CHANGE_INIT:
@@ -508,7 +508,7 @@  static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
 {
 	struct s5p_mfc_dev *dev;
 
-	if (ctx == NULL)
+	if (!ctx)
 		return;
 	dev = ctx->dev;
 	if (ctx->c_ops->post_seq_start) {
@@ -562,7 +562,7 @@  static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx,
 	struct s5p_mfc_buf *src_buf;
 	struct s5p_mfc_dev *dev;
 
-	if (ctx == NULL)
+	if (!ctx)
 		return;
 	dev = ctx->dev;
 	s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
@@ -1289,7 +1289,7 @@  static int s5p_mfc_probe(struct platform_device *pdev)
 		return PTR_ERR(dev->regs_base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL) {
+	if (!res) {
 		dev_err(&pdev->dev, "failed to get irq resource\n");
 		return -ENOENT;
 	}