[PATCH:xf86-video-s3] When checking malloc for success, it helps to use == NULL, instead of =
Alan Coopersmith
alan.coopersmith at oracle.com
Sat Mar 12 19:02:03 UTC 2016
Fixes gcc 5.3 compiler warning:
s3_bios.c: In function 'find_bios_string':
s3_bios.c:49:2: warning: suggest parentheses around assignment used as
truth value [-Wparentheses]
if (bios = NULL)
^
[Tested by compiling only, as I have no S3 hardware, but clearly no one
else has tested this code since commit c41a1188ce53 in 2009, as it would
be segfaulting if run.]
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
src/s3_bios.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/s3_bios.c b/src/s3_bios.c
index 323e2ce..1c7c5fe 100644
--- a/src/s3_bios.c
+++ b/src/s3_bios.c
@@ -46,7 +46,7 @@ static unsigned char *find_bios_string(ScrnInfoPtr pScrn, int BIOSbase,
S3Ptr pS3 = S3PTR(pScrn);
bios = malloc(BIOS_BSIZE);
- if (bios = NULL)
+ if (bios == NULL)
return NULL;
if (!init) {
--
2.6.1
More information about the xorg-devel
mailing list